2
0
mirror of https://github.com/VinylDNS/vinyldns synced 2025-08-30 13:58:15 +00:00

Functional Test for Update Zone changes for invalid domain

This commit is contained in:
ssranjani06 2023-03-23 11:17:41 +05:30
parent a7708657f1
commit bb2bc3a43d
No known key found for this signature in database
GPG Key ID: 5962790EC1D37DD5

View File

@ -171,6 +171,52 @@ def test_update_invalid_email(shared_zone_test_context):
if result_zone:
client.abandon_zones([result_zone["id"]], status=202)
def test_update_invalid_domain(shared_zone_test_context):
"""
Test that updating a zone with invalid domain
"""
client = shared_zone_test_context.ok_vinyldns_client
result_zone = None
try:
zone_name = f"one-time{shared_zone_test_context.partition_id}"
acl_rule = {
"accessLevel": "Read",
"description": "test-acl-updated-by-updatezn",
"userId": "ok",
"recordMask": "www-*",
"recordTypes": ["A", "AAAA", "CNAME"]
}
zone = {
"name": zone_name,
"email": "test@test.com",
"adminGroupId": shared_zone_test_context.ok_group["id"],
"connection": {
"name": "vinyldns.",
"keyName": VinylDNSTestContext.dns_key_name,
"key": VinylDNSTestContext.dns_key,
"primaryServer": VinylDNSTestContext.name_server_ip
},
"transferConnection": {
"name": "vinyldns.",
"keyName": VinylDNSTestContext.dns_key_name,
"key": VinylDNSTestContext.dns_key,
"primaryServer": VinylDNSTestContext.name_server_ip
}
}
result = client.create_zone(zone, status=202)
result_zone = result["zone"]
client.wait_until_zone_active(result_zone["id"])
result_zone["email"] = "test@trial.com"
errors = client.update_zone(result_zone, status=400)
assert_that(errors, is_("Please enter a valid Email ID. Valid domains should end with test.com,dummy.com"))
finally:
if result_zone:
client.abandon_zones([result_zone["id"]], status=202)
def test_update_zone_sync_schedule_fails(shared_zone_test_context):
"""
Test updating a zone with a schedule for zone sync fails when the user is not an admin user