Skip to content

Commit

Permalink
tests: add tests for numeric eacl rules
Browse files Browse the repository at this point in the history
closes #738

Signed-off-by: Evgeniy Zayats <[email protected]>
  • Loading branch information
Evgeniy Zayats committed Apr 5, 2024
1 parent 1ce940a commit 00919d4
Show file tree
Hide file tree
Showing 4 changed files with 604 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pytest_tests/lib/helpers/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,21 @@ class EACLHeaderType(Enum):
class EACLMatchType(Enum):
STRING_EQUAL = "=" # Return true if strings are equal
STRING_NOT_EQUAL = "!=" # Return true if strings are different
NUM_GT = ">"
NUM_GE = ">="
NUM_LT = "<"
NUM_LE = "<="

def compare(self, val1, val2):
if self.value == ">":
return val1 > val2
elif self.value == ">=":
return val1 >= val2
elif self.value == "<":
return val1 < val2
elif self.value == "<=":
return val1 <= val2
raise AssertionError(f"Unsupported value: {self.value} for compare")


@dataclass
Expand Down
1 change: 1 addition & 0 deletions pytest_tests/lib/helpers/grpc_responses.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
)

INVALID_SEARCH_QUERY = ".*invalid search query.*"
INVALID_RULES = ".*unable to parse provided rules.*"


def error_matches_status(error: Exception, status_pattern: str) -> bool:
Expand Down
4 changes: 3 additions & 1 deletion pytest_tests/lib/helpers/object_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def can_get_object(
err, OBJECT_ACCESS_DENIED
), f"Expected {err} to match {OBJECT_ACCESS_DENIED}"
return False
assert get_file_hash(file_name) == get_file_hash(got_file_path)
assert get_file_hash(file_name) == get_file_hash(
got_file_path
), "file hash of downloaded object is not equal to the uploaded"
return True


Expand Down
Loading

0 comments on commit 00919d4

Please sign in to comment.