2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-09-01 14:55:22 +00:00

Add and update tests

This commit is contained in:
Aravindh-Raju
2022-08-17 17:13:52 +05:30
parent d33d559ce2
commit aaf171bc34
5 changed files with 122 additions and 26 deletions

View File

@@ -18,6 +18,43 @@ def test_get_status_success(shared_zone_test_context):
assert_that(result["version"], not_none())
def test_post_status_fails_for_non_admin_users(shared_zone_test_context):
"""
Tests that the post request to status endpoint fails for non-admin users
"""
client = shared_zone_test_context.ok_vinyldns_client
result = client.post_status(True)
assert_that(result, is_("Not authorized. User 'ok' cannot make the requested change."))
def test_post_status_fails_for_non_users(shared_zone_test_context):
"""
Tests that the post request to status endpoint fails for non-users with fake access and secret key
"""
client = shared_zone_test_context.non_user_client
result = client.post_status(True)
assert_that(result, is_("Authentication Failed: Account with accessKey not-exist-key specified was not found"))
def test_post_status_pass_for_admin_users(shared_zone_test_context):
"""
Tests that the post request to status endpoint pass for admin users
"""
client = shared_zone_test_context.support_user_client
client.post_status(True)
status = client.get_status()
assert_that(status["processingDisabled"], is_(True))
client.post_status(False)
status = client.get_status()
assert_that(status["processingDisabled"], is_(False))
@pytest.mark.serial
@pytest.mark.skip_production
def test_toggle_processing(shared_zone_test_context):
@@ -25,15 +62,16 @@ def test_toggle_processing(shared_zone_test_context):
Test that updating a zone when processing is disabled does not happen
"""
client = shared_zone_test_context.ok_vinyldns_client
admin_client = shared_zone_test_context.support_user_client
ok_zone = copy.deepcopy(shared_zone_test_context.ok_zone)
# disable processing
client.post_status(True)
admin_client.post_status(True)
status = client.get_status()
assert_that(status["processingDisabled"], is_(True))
client.post_status(False)
admin_client.post_status(False)
status = client.get_status()
assert_that(status["processingDisabled"], is_(False))