Skip to content

Commit

Permalink
Add user key test with base64 value
Browse files Browse the repository at this point in the history
  • Loading branch information
mkudlej committed Aug 30, 2024
1 parent 6d20a0a commit 4dd8245
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def application(account, application_plan, application_params) -> Application:

@pytest.fixture(scope='module')
def app_key_params(account, application):
value = ''.join(random.choices(string.ascii_uppercase + string.digits + '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~', k=100))
value = ''.join(random.choices(string.ascii_uppercase + string.digits + '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~', k=255))
return({"application_id": application["id"], "account_id": account["id"], "key": value})


Expand Down
12 changes: 11 additions & 1 deletion tests/integration/test_integration_application.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import random
import string
import base64
import secrets
import pytest

Expand Down Expand Up @@ -38,8 +39,17 @@ def test_application_key_list(application, app_key):
keys = application.keys.list()
assert len(keys) > 0


def test_application_update_userkey(application):
new_key = "".join(random.choices(string.ascii_letters + string.digits + "-_.", k=100))
new_key = "".join(random.choices(string.ascii_letters + string.digits + "-_.", k=255))
updated_application = application.update(params={"user_key": new_key})
asserts.assert_resource(updated_application)
assert updated_application["user_key"] == new_key


def test_application_update_userkey_base64(application):
new_key = "".join(random.choices(string.ascii_letters + string.digits + "-_.", k=41))
new_key = base64.b64encode(new_key.encode('ascii')).decode()
updated_application = application.update(params={"user_key": new_key})
asserts.assert_resource(updated_application)
assert updated_application["user_key"] == new_key

0 comments on commit 4dd8245

Please sign in to comment.