mirror of
https://github.com/VinylDNS/vinyldns
synced 2025-08-31 06:15:49 +00:00
clean up after ourselves in the manual review tests (#810)
This commit is contained in:
committed by
Britney Wright
parent
e3f8dfadec
commit
7bdeb39a02
@@ -39,22 +39,28 @@ def test_cancel_batch_change_fails_for_non_creator(shared_zone_test_context):
|
||||
Test cancelling a batch change fails for a user who didn't make the batch change
|
||||
"""
|
||||
client = shared_zone_test_context.ok_vinyldns_client
|
||||
rejector = shared_zone_test_context.support_user_client
|
||||
rejecter = shared_zone_test_context.support_user_client
|
||||
batch_change_input = {
|
||||
"changes": [
|
||||
get_change_A_AAAA_json("zone.discovery.failure.", address="4.3.2.1")
|
||||
],
|
||||
"ownerGroupId": shared_zone_test_context.ok_group['id']
|
||||
}
|
||||
result = client.create_batch_change(batch_change_input, status=202)
|
||||
get_batch = client.get_batch_change(result['id'])
|
||||
assert_that(get_batch['status'], is_('PendingReview'))
|
||||
assert_that(get_batch['approvalStatus'], is_('PendingReview'))
|
||||
assert_that(get_batch['changes'][0]['status'], is_('NeedsReview'))
|
||||
assert_that(get_batch['changes'][0]['validationErrors'][0]['errorType'], is_('ZoneDiscoveryError'))
|
||||
result = None
|
||||
try:
|
||||
result = client.create_batch_change(batch_change_input, status=202)
|
||||
get_batch = client.get_batch_change(result['id'])
|
||||
assert_that(get_batch['status'], is_('PendingReview'))
|
||||
assert_that(get_batch['approvalStatus'], is_('PendingReview'))
|
||||
assert_that(get_batch['changes'][0]['status'], is_('NeedsReview'))
|
||||
assert_that(get_batch['changes'][0]['validationErrors'][0]['errorType'], is_('ZoneDiscoveryError'))
|
||||
|
||||
error = rejecter.cancel_batch_change(get_batch['id'], status=403)
|
||||
assert_that(error, is_("User does not have access to item " + get_batch['id']))
|
||||
finally:
|
||||
if result:
|
||||
rejecter.reject_batch_change(result['id'], status=200)
|
||||
|
||||
error = rejector.cancel_batch_change(get_batch['id'], status=403)
|
||||
assert_that(error, is_("User does not have access to item " + get_batch['id']))
|
||||
|
||||
@pytest.mark.manual_batch_review
|
||||
def test_cancel_batch_change_fails_when_not_pending_approval(shared_zone_test_context):
|
||||
|
@@ -286,10 +286,15 @@ def test_create_batch_change_with_scheduled_time_and_owner_group_succeeds(shared
|
||||
"scheduledTime": dt,
|
||||
"ownerGroupId": shared_zone_test_context.ok_group['id']
|
||||
}
|
||||
|
||||
result = client.create_batch_change(batch_change_input, status=202)
|
||||
assert_that(result['status'], 'Scheduled')
|
||||
assert_that(result['scheduledTime'], dt)
|
||||
result = None
|
||||
try:
|
||||
result = client.create_batch_change(batch_change_input, status=202)
|
||||
assert_that(result['status'], 'Scheduled')
|
||||
assert_that(result['scheduledTime'], dt)
|
||||
finally:
|
||||
if result:
|
||||
rejecter = shared_zone_test_context.support_user_client
|
||||
rejecter.reject_batch_change(result['id'], status=200)
|
||||
|
||||
|
||||
@pytest.mark.manual_batch_review
|
||||
|
@@ -167,14 +167,21 @@ def test_list_batch_change_summaries_with_pending_status(shared_zone_test_contex
|
||||
"ownerGroupId": group['id']
|
||||
}
|
||||
|
||||
client.create_batch_change(batch_change_input, status=202)
|
||||
pending_bc = None
|
||||
try:
|
||||
pending_bc = client.create_batch_change(batch_change_input, status=202)
|
||||
|
||||
batch_change_summaries_result = client.list_batch_change_summaries(status=200, approval_status="PendingReview")
|
||||
batch_change_summaries_result = client.list_batch_change_summaries(status=200, approval_status="PendingReview")
|
||||
|
||||
for batchChange in batch_change_summaries_result['batchChanges']:
|
||||
assert_that(batchChange['approvalStatus'], is_('PendingReview'))
|
||||
assert_that(batchChange['status'], is_('PendingReview'))
|
||||
assert_that(batchChange['totalChanges'], equal_to(1))
|
||||
finally:
|
||||
if pending_bc:
|
||||
rejecter = shared_zone_test_context.support_user_client
|
||||
rejecter.reject_batch_change(pending_bc['id'], status=200)
|
||||
|
||||
for batchChange in batch_change_summaries_result['batchChanges']:
|
||||
assert_that(batchChange['approvalStatus'], is_('PendingReview'))
|
||||
assert_that(batchChange['status'], is_('PendingReview'))
|
||||
assert_that(batchChange['totalChanges'], equal_to(1))
|
||||
|
||||
def test_list_batch_change_summaries_with_list_batch_change_summaries_with_no_changes_passes():
|
||||
"""
|
||||
|
Reference in New Issue
Block a user