def test_decrypt_missing_ciphertext(client, attr_auth_access_token_one): data = { "access_token": attr_auth_access_token_one, "api_username": "******" } assert_got_error_from_get(client, '/attr_auth/decrypt', data, 400, CIPHERTEXT_MISSING_ERROR_MSG)
def test_decrypt_invalid_owner(client, attr_auth_access_token_one, attr_auth_access_token_two): data = { "access_token": attr_auth_access_token_two, "api_username": "******", "ciphertext": "anything-doesnt-matter" } assert_got_error_from_get(client, '/attr_auth/decrypt', data, 400, INVALID_OWNER_API_USERNAME_ERROR_MSG)
def test_decrypt_could_not_decrypt(client, attr_auth_access_token_one, attr_auth_access_token_two): data = { "access_token": attr_auth_access_token_two, "api_username": "******" } plaintext = "any text" data_encrypt = { "access_token": attr_auth_access_token_one, "message": plaintext, "policy_string": "(TODAY)" # INVALID } status_code, json_data = get_data_from_get(client, '/attr_auth/encrypt', data_encrypt) assert json_data["ciphertext"] is not None data["ciphertext"] = json_data["ciphertext"] assert_got_error_from_get(client, '/attr_auth/decrypt', data, 400, COULD_NOT_DECRYPT_ERROR_MSG)
def test_require_attr_auth_access_token_missing(client): data = {"access_token": "missing"} assert_got_error_from_get(client, '/attr_auth/setup', data, 400, INVALID_ACCESS_TOKEN_ERROR_MSG)
def test_encrypt_missing_policy_string(client, attr_auth_access_token_one): data = {"access_token": attr_auth_access_token_one, "message": "any text"} assert_got_error_from_get(client, '/attr_auth/encrypt', data, 400, POLICY_STRING_MISSING_ERROR_MSG)
def test_encrypt_missing_plaintext(client, attr_auth_access_token_one): data = {"access_token": attr_auth_access_token_one} assert_got_error_from_get(client, '/attr_auth/encrypt', data, 400, MESSAGE_MISSING_ERROR_MSG)
def test_decrypt_missing_owner_api_username(client, attr_auth_access_token_one): data = {"access_token": attr_auth_access_token_one} assert_got_error_from_get(client, '/attr_auth/decrypt', data, 400, OWNER_API_USERNAME_MISSING_ERROR_MSG)