Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a4e206e
Fix test_append neg tests
juliannguyen4 Apr 21, 2023
e0ee1df
Changed tests in test_remove_bin.py
DomPeliniAerospike Nov 20, 2023
c931bc0
Revert test_remove_bin to original behavior
juliannguyen4 Nov 20, 2023
6a3ac8c
Fix prepend test
juliannguyen4 Nov 20, 2023
b319732
Fix more admin tests
juliannguyen4 Nov 20, 2023
8e16813
Fix more admin tests
juliannguyen4 Nov 20, 2023
fd60e4a
Finish fixing admin tests and more API tests
juliannguyen4 Nov 21, 2023
0bf7902
Fix a few get put tests
juliannguyen4 Nov 21, 2023
ac3b1cf
Fix more
juliannguyen4 Nov 27, 2023
25a795a
finish cleaning
juliannguyen4 Nov 30, 2023
66f9a03
Exists shouldnt throw an error if record not found
juliannguyen4 Nov 30, 2023
030c475
revert max_error_rate test
juliannguyen4 Nov 30, 2023
e0592df
Fix some tests
juliannguyen4 Nov 30, 2023
b59817b
Fix bug
juliannguyen4 Nov 30, 2023
632a051
Fix test
juliannguyen4 Nov 30, 2023
4bca4ac
fix
juliannguyen4 Dec 2, 2023
3438330
Revert tests that were failing but could not fix
juliannguyen4 Dec 8, 2023
baf9218
Revert "Fix bug"
juliannguyen4 Dec 8, 2023
adb74c1
Merge remote-tracking branch 'origin/dev' into CLIENT-2305-false-pos-…
juliannguyen4 Sep 27, 2024
baafb85
Merge remote-tracking branch 'origin/dev' into CLIENT-2305-false-pos-…
juliannguyen4 Sep 19, 2025
6224dd5
fix max_error_rate tests. check if tests are correct or not
juliannguyen4 Sep 19, 2025
4e078e2
Merge remote-tracking branch 'origin/dev' into CLIENT-2305-false-pos-…
juliannguyen4 Feb 3, 2026
49d347d
Merge remote-tracking branch 'origin/dev' into CLIENT-2305-false-pos-…
juliannguyen4 Feb 9, 2026
48c71cd
WIP TODO
juliannguyen4 Feb 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions test/new_tests/test_admin_change_password.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ def test_change_password_with_invalid_timeout_policy_value(self):
user = "testchangepassworduser"
password = "newpassword"

try:
with pytest.raises(aerospike.exception.ParamError) as excinfo:
self.client.admin_change_password(user, password, policy)

except aerospike.exception.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"

# NOTE: This will fail if auth_mode is PKI_AUTH (3).
@pytest.mark.xfail(reason="Might fail depending on auth_mode.")
Expand Down Expand Up @@ -116,24 +114,20 @@ def test_change_password_with_none_username(self):
user = None
password = "newpassword"

try:
with pytest.raises(aerospike.exception.ParamError) as excinfo:
self.client.admin_change_password(user, password)

except aerospike.exception.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Username should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Username should be a string"

def test_change_password_with_none_password(self):

user = "testchangepassworduser"
password = None

try:
with pytest.raises(aerospike.exception.ParamError) as excinfo:
self.client.admin_change_password(user, password)

except aerospike.exception.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Password should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Password should be a string"

def test_change_password_with_non_existent_user(self):

Expand Down
16 changes: 6 additions & 10 deletions test/new_tests/test_admin_create_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,10 @@ def test_create_role_incorrect_role_type(self):
"""
role name not string
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_create_role(1, [{"code": aerospike.PRIV_USER_ADMIN}])
except e.ParamError as exception:
assert exception.code == -2
assert "Role name should be a string" in exception.msg
assert excinfo.value.code == -2
assert "Role name should be a string" in excinfo.value.msg

def test_create_role_unknown_privilege_type(self):
"""
Expand All @@ -277,12 +276,10 @@ def test_create_role_incorrect_privilege_type(self):
"""
privilege type incorrect
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_create_role("usr-sys-admin-test", None)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Privileges should be a list"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Privileges should be a list"

def test_create_role_existing_role(self):
"""
Expand All @@ -303,7 +300,6 @@ def test_create_role_existing_role(self):
self.client.admin_create_role(
"usr-sys-admin-test", [{"code": aerospike.PRIV_USER_ADMIN}, {"code": aerospike.PRIV_SYS_ADMIN}]
)

except e.RoleExistsError as exception:
assert exception.code == 71
assert exception.msg == "AEROSPIKE_ROLE_ALREADY_EXISTS"
Expand Down
24 changes: 9 additions & 15 deletions test/new_tests/test_admin_create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ def test_create_user_with_invalid_timeout_policy_value(self):
except Exception:
pass

try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_create_user(user, password, roles, policy)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"

def test_create_user_with_proper_timeout_policy_value(self):

Expand Down Expand Up @@ -146,12 +144,10 @@ def test_create_user_with_none_username(self):
password = "user3-test"
roles = ["sys-admin"]

try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_create_user(user, password, roles)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Username should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Username should be a string"

def test_create_user_with_empty_username(self):

Expand Down Expand Up @@ -190,12 +186,10 @@ def test_create_user_with_none_password(self):
password = None
roles = ["sys-admin"]

try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_create_user(user, password, roles)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Password should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Password should be a string"

def test_create_user_with_empty_string_as_password(self):

Expand Down
16 changes: 7 additions & 9 deletions test/new_tests/test_admin_drop_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,10 @@ def test_drop_role_rolename_None(self):
"""
Drop role with role name None
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_drop_role(None)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Role name should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Role name should be a string"

def test_drop_role_with_incorrect_policy(self):
"""
Expand All @@ -151,12 +149,12 @@ def test_drop_role_with_incorrect_policy(self):

assert status == 0
time.sleep(3)
try:

with pytest.raises(e.ParamError) as excinfo:
self.client.admin_drop_role("usr-sys-admin-test", {"timeout": 0.2})
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
try:
self.client.admin_drop_role("usr-sys-admin-test")
except Exception:
Expand Down
16 changes: 6 additions & 10 deletions test/new_tests/test_admin_drop_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,10 @@ def test_drop_user_with_user_none(self):
"""
Invoke drop_user() with policy none
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_drop_user(None)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Username should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Username should be a string"

def test_drop_user_positive(self):
"""
Expand Down Expand Up @@ -175,12 +173,10 @@ def test_drop_user_policy_incorrect(self):

assert user_details["roles"] == ["read", "read-write", "sys-admin"]
policy = {"timeout": 0.2}
try:
with pytest.raises(e.ParamError) as excinfo:
status = self.client.admin_drop_user(user, policy)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"

status = self.client.admin_drop_user(user)

Expand Down
8 changes: 3 additions & 5 deletions test/new_tests/test_admin_get_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ def test_admin_get_role_incorrect_role_type(self):
"""
Incorrect role type
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_get_role(None)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Role name should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Role name should be a string"
8 changes: 3 additions & 5 deletions test/new_tests/test_admin_get_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ def test_admin_get_roles_incorrect_policy(self):
"""
Get roles incorrect policy
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_get_roles({"timeout": 0.2})

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"
16 changes: 6 additions & 10 deletions test/new_tests/test_admin_grant_privileges.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,10 @@ def test_grant_privileges_incorrect_role_type(self):
"""
role name not string
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_grant_privileges(1, [{"code": aerospike.PRIV_USER_ADMIN}])

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Role name should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Role name should be a string"

def test_grant_privileges_unknown_privilege_type(self):
"""
Expand All @@ -187,12 +185,10 @@ def test_grant_privileges_incorrect_privilege_type(self):
"""
privilege type incorrect
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_grant_privileges("usr-sys-admin-test", None)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Privileges should be a list"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Privileges should be a list"

def test_grant_privileges_empty_list_privileges(self):
"""
Expand Down
16 changes: 6 additions & 10 deletions test/new_tests/test_admin_grant_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@ def test_grant_roles_with_invalid_timeout_policy_value(self):
user = "example-test"
roles = ["sys-admin"]

try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_grant_roles(user, roles, policy)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"

def test_grant_roles_with_proper_timeout_policy_value(self):

Expand All @@ -115,12 +113,10 @@ def test_grant_roles_with_none_username(self):
user = None
roles = ["sys-admin"]

try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_grant_roles(user, roles)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Username should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Username should be a string"

def test_grant_roles_with_empty_username(self):

Expand Down
8 changes: 3 additions & 5 deletions test/new_tests/test_admin_query_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ def test_admin_query_role_incorrect_role_type(self):
"""
Incorrect role type
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_query_role(None)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Role name should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Role name should be a string"
8 changes: 3 additions & 5 deletions test/new_tests/test_admin_query_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ def test_admin_query_roles_incorrect_policy(self):
"""
Query roles incorrect policy
"""
try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_query_roles({"timeout": 0.2})

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "timeout is invalid"
assert excinfo.value.code == -2
assert excinfo.value.msg == "timeout is invalid"
32 changes: 12 additions & 20 deletions test/new_tests/test_admin_query_user_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,34 +93,28 @@ def test_query_user_info_with_none_username(self):

user = None

try:
with pytest.raises(e.ParamError) as excinfo:
self.client.admin_query_user_info(user)

except e.ParamError as exception:
assert exception.code == -2
assert exception.msg == "Username should be a string"
assert excinfo.value.code == -2
assert excinfo.value.msg == "Username should be a string"

def test_query_user_info_with_empty_username(self):

user = ""

try:
with pytest.raises(e.InvalidUser) as excinfo:
self.client.admin_query_user_info(user)

except e.InvalidUser as exception:
assert exception.code == 60
assert exception.msg == "AEROSPIKE_INVALID_USER"
assert excinfo.value.code == 60
assert excinfo.value.msg == "AEROSPIKE_INVALID_USER"

def test_query_user_info_with_nonexistent_username(self):

user = "non-existent"

try:
with pytest.raises(e.InvalidUser) as excinfo:
self.client.admin_query_user_info(user)

except e.InvalidUser as exception:
assert exception.code == 60
assert exception.msg == "AEROSPIKE_INVALID_USER"
assert excinfo.value.code == 60
assert excinfo.value.msg == "AEROSPIKE_INVALID_USER"

def test_query_user_info_with_no_roles(self):

Expand Down Expand Up @@ -148,9 +142,7 @@ def test_query_user_info_with_policy_as_string(self):
Invoke query_user() with policy as string
"""
policy = ""
try:
with pytest.raises(e.AerospikeError) as excinfo:
self.client.admin_query_user_info("foo", policy)

except e.AerospikeError as exception:
assert exception.code == -2
assert exception.msg == "policy must be a dict"
assert excinfo.value.code == -2
assert excinfo.value.msg == "policy must be a dict"
Loading
Loading