mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-09-05 08:45:11 +00:00
add locked user account with auth check to api (#172)
add locked user account with auth check to api
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
from utils import *
|
||||
from hamcrest import *
|
||||
from vinyldns_python import VinylDNSClient
|
||||
from dns.resolver import *
|
||||
from vinyldns_context import VinylDNSTestContext
|
||||
|
||||
|
||||
def test_request_fails_when_user_account_is_locked():
|
||||
"""
|
||||
Test request fails with Forbidden (403) when user account is locked
|
||||
"""
|
||||
client = VinylDNSClient(VinylDNSTestContext.vinyldns_url, 'lockedAccessKey', 'lockedSecretKey')
|
||||
client.list_batch_change_summaries(status=403)
|
||||
|
||||
def test_request_fails_when_user_is_not_found():
|
||||
"""
|
||||
Test request fails with Unauthorized (401) when user account is not found
|
||||
"""
|
||||
client = VinylDNSClient(VinylDNSTestContext.vinyldns_url, 'unknownAccessKey', 'anyAccessSecretKey')
|
||||
|
||||
client.list_batch_change_summaries(status=401)
|
||||
|
||||
def test_request_succeeds_when_user_is_found_and_not_locked():
|
||||
"""
|
||||
Test request success with Success (200) when user account is found and not locked
|
||||
"""
|
||||
client = VinylDNSClient(VinylDNSTestContext.vinyldns_url, 'okAccessKey', 'okSecretKey')
|
||||
|
||||
client.list_batch_change_summaries(status=200)
|
@@ -93,7 +93,7 @@ def test_list_group_members_start_from(shared_zone_test_context):
|
||||
|
||||
# members has one more because admins are added as members
|
||||
assert_that(result['members'], has_length(len(members) + 1))
|
||||
assert_that(result['members'], has_item({ 'id': 'ok'}))
|
||||
assert_that(result['members'], has_item({ 'lockStatus': 'Unlocked', 'id': 'ok'}))
|
||||
result_member_ids = map(lambda member: member['id'], result['members'])
|
||||
for user in members:
|
||||
assert_that(result_member_ids, has_item(user['id']))
|
||||
|
Reference in New Issue
Block a user