2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-31 06:15:49 +00:00

JSON deserialization and protobuf changes for remove single DNS record entry (#795)

* Support DeleteRecord in API
This commit is contained in:
Michael Ly
2019-08-21 15:32:23 -04:00
committed by GitHub
parent d0d88dc0ea
commit ed1f2c7e6f
20 changed files with 463 additions and 133 deletions

View File

@@ -3197,6 +3197,7 @@ def test_create_batch_duplicates_update_check(shared_zone_test_context):
finally:
clear_recordset_list(to_delete, client)
@pytest.mark.manual_batch_review
def test_zone_name_requiring_manual_review(shared_zone_test_context):
"""
@@ -3229,3 +3230,34 @@ def test_zone_name_requiring_manual_review(shared_zone_test_context):
# Clean up so data doesn't change
if response:
rejecter.reject_batch_change(response['id'], status=200)
def test_create_batch_delete_record_fails(shared_zone_test_context):
"""
Test creating batch change with DeleteRecord change input type is not recognized
"""
client = shared_zone_test_context.ok_vinyldns_client
ok_zone = shared_zone_test_context.ok_zone
ok_group = shared_zone_test_context.ok_group
rs_to_create = get_recordset_json(ok_zone, "delete-record", "A", [{"address": "1.2.3.4"}], 200, ok_group['id'])
batch_change_input = {
"comments": "this is optional",
"changes": [
get_change_A_AAAA_json("delete-record.ok.", change_type="DeleteRecord")
]
}
create_rs = None
try:
create_rs = client.create_recordset(rs_to_create, status=202)
client.wait_until_recordset_change_status(create_rs, 'Complete')
# TODO: Update this when DeleteRecord is supported
client.create_batch_change(batch_change_input, status=400)
finally:
if create_rs:
delete_rs = client.delete_recordset(ok_zone['id'], create_rs['recordSet']['id'], status=202)
client.wait_until_recordset_change_status(delete_rs, 'Complete')

View File

@@ -418,11 +418,21 @@ def get_change_A_AAAA_json(input_name, record_type="A", ttl=200, address="1.1.1.
}
}
else:
json = {
"changeType": "DeleteRecordSet",
"inputName": input_name,
"type": record_type
}
if change_type == "DeleteRecord":
json = {
"changeType": "DeleteRecord",
"inputName": input_name,
"type": record_type,
"record": {
"address": address
}
}
else:
json = {
"changeType": "DeleteRecordSet",
"inputName": input_name,
"type": record_type
}
return json
def get_change_CNAME_json(input_name, ttl=200, cname="test.com", change_type="Add"):