2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-30 22:05:21 +00:00

Implement domains requiring manual review (via batch change interface) (#779)

* Implement domains requiring review.
* Update configs.
* Update tests.
This commit is contained in:
Michael Ly
2019-08-07 10:33:18 -04:00
committed by GitHub
parent e0456491fb
commit 9014570a37
14 changed files with 238 additions and 48 deletions

View File

@@ -11,7 +11,8 @@ def test_approve_pending_batch_change_success(shared_zone_test_context):
approver = shared_zone_test_context.support_user_client
batch_change_input = {
"changes": [
get_change_A_AAAA_json("test-approve-success.not.loaded.", address="4.3.2.1")
get_change_A_AAAA_json("test-approve-success.not.loaded.", address="4.3.2.1"),
get_change_A_AAAA_json("needs-review.not.loaded.", address="4.3.2.1"),
],
"ownerGroupId": shared_zone_test_context.ok_group['id']
}
@@ -25,6 +26,8 @@ def test_approve_pending_batch_change_success(shared_zone_test_context):
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'))
assert_that(get_batch['changes'][1]['status'], is_('NeedsReview'))
assert_that(get_batch['changes'][1]['validationErrors'][0]['errorType'], is_('RecordRequiresManualReview'))
# need to create the zone so the change can succeed
zone = {
@@ -43,12 +46,13 @@ def test_approve_pending_batch_change_success(shared_zone_test_context):
to_delete = [(change['zoneId'], change['recordSetId']) for change in completed_batch['changes']]
assert_that(completed_batch['status'], is_('Complete'))
assert_that(completed_batch['changes'][0]['status'], is_('Complete'))
for change in completed_batch['changes']:
assert_that(change['status'], is_('Complete'))
assert_that(len(change['validationErrors']), is_(0))
assert_that(completed_batch['approvalStatus'], is_('ManuallyApproved'))
assert_that(completed_batch['reviewerId'], is_('support-user-id'))
assert_that(completed_batch['reviewerUserName'], is_('support-user'))
assert_that(completed_batch, has_key('reviewTimestamp'))
assert_that(len(completed_batch['changes'][0]['validationErrors']), is_(0))
finally:
clear_zoneid_rsid_tuple_list(to_delete, client)
if to_disconnect is not None:

View File

@@ -882,6 +882,52 @@ def test_create_batch_change_with_high_value_domain_fails(shared_zone_test_conte
assert_that(response[12], is_not(has_key("errors")))
@pytest.mark.manual_batch_review
def test_create_batch_change_with_domains_requiring_review_succeeds(shared_zone_test_context):
"""
Test creating a batch change with an input name requiring review is accepted
"""
rejecter = shared_zone_test_context.support_user_client
client = shared_zone_test_context.ok_vinyldns_client
batch_change_input = {
"ownerGroupId": shared_zone_test_context.ok_group['id'],
"comments": "this is optional",
"changes": [
get_change_A_AAAA_json("needs-review-add.ok."),
get_change_A_AAAA_json("needs-review-update.ok.", change_type="DeleteRecordSet"),
get_change_A_AAAA_json("needs-review-update.ok."),
get_change_A_AAAA_json("needs-review-delete.ok.", change_type="DeleteRecordSet"),
get_change_PTR_json("192.0.2.254"),
get_change_PTR_json("192.0.2.255", change_type="DeleteRecordSet"), # 255 exists already
get_change_PTR_json("192.0.2.255"),
get_change_PTR_json("192.0.2.255", change_type="DeleteRecordSet"),
get_change_PTR_json("fd69:27cc:fe91:0:0:0:ffff:1"),
get_change_PTR_json("fd69:27cc:fe91:0:0:0:ffff:2", change_type="DeleteRecordSet"), # ffff:2 exists already
get_change_PTR_json("fd69:27cc:fe91:0:0:0:ffff:2"),
get_change_PTR_json("fd69:27cc:fe91:0:0:0:ffff:2", change_type="DeleteRecordSet"),
get_change_A_AAAA_json("i-can-be-touched.ok.", address="1.1.1.1")
]
}
response = None
try:
response = client.create_batch_change(batch_change_input, status=202)
get_batch = client.get_batch_change(response['id'])
assert_that(get_batch['status'], is_('PendingReview'))
assert_that(get_batch['approvalStatus'], is_('PendingReview'))
for i in xrange(1, 11):
assert_that(get_batch['changes'][i]['status'], is_('NeedsReview'))
assert_that(get_batch['changes'][i]['validationErrors'][0]['errorType'], is_('RecordRequiresManualReview'))
assert_that(get_batch['changes'][12]['validationErrors'], empty())
finally:
# Clean up so data doesn't change
if response:
rejecter.reject_batch_change(response['id'], status=200)
def test_create_batch_change_with_invalid_record_type_fails(shared_zone_test_context):
"""
Test creating a batch change with invalid record type fails