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

Require owner group ID for soft errors (#775)

* Require owner group ID for soft errors.
* Update tests.
This commit is contained in:
Michael Ly
2019-07-30 12:45:53 -04:00
committed by GitHub
parent 48d6ebe01d
commit a72c7faf0a
6 changed files with 84 additions and 11 deletions

View File

@@ -271,9 +271,9 @@ def test_create_batch_change_with_adds_success(shared_zone_test_context):
@pytest.mark.manual_batch_review
def test_create_batch_change_with_scheduled_time_succeeds(shared_zone_test_context):
def test_create_batch_change_with_scheduled_time_and_owner_group_succeeds(shared_zone_test_context):
"""
Test successfully creating a batch change with scheduled time set
Test successfully creating a batch change with scheduled time and owner group set
"""
client = shared_zone_test_context.ok_vinyldns_client
dt = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')
@@ -283,7 +283,8 @@ def test_create_batch_change_with_scheduled_time_succeeds(shared_zone_test_conte
"changes": [
get_change_A_AAAA_json("parent.com.", address="4.5.6.7"),
],
"scheduledTime": dt
"scheduledTime": dt,
"ownerGroupId": shared_zone_test_context.ok_group['id']
}
result = client.create_batch_change(batch_change_input, status=202)
@@ -291,6 +292,27 @@ def test_create_batch_change_with_scheduled_time_succeeds(shared_zone_test_conte
assert_that(result['scheduledTime'], dt)
@pytest.mark.manual_batch_review
def test_create_scheduled_batch_change_with_zone_discovery_error_without_owner_group_fails(shared_zone_test_context):
"""
Test creating a scheduled batch without owner group ID fails if there is a zone discovery error
"""
client = shared_zone_test_context.ok_vinyldns_client
dt = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')
batch_change_input = {
"comments": "this is optional",
"changes": [
get_change_A_AAAA_json("no-owner-group.scheduled.parent.com.", address="4.5.6.7"),
],
"scheduledTime": dt
}
errors = client.create_batch_change(batch_change_input, status=400)
assert_that(errors, is_("Batch change requires owner group for manual review/scheduled changes."))
def test_create_batch_change_without_scheduled_time_succeeds(shared_zone_test_context):
"""
Test successfully creating a batch change without scheduled time set
@@ -314,6 +336,24 @@ def test_create_batch_change_without_scheduled_time_succeeds(shared_zone_test_co
clear_zoneid_rsid_tuple_list(to_delete, client)
@pytest.mark.manual_batch_review
def test_create_batch_change_with_zone_discovery_error_without_owner_group_fails(shared_zone_test_context):
"""
Test creating a batch change with zone discovery error fails if no owner group ID is provided
"""
client = shared_zone_test_context.ok_vinyldns_client
batch_change_input = {
"changes": [
get_change_A_AAAA_json("some.non-existent.zone.", address="1.1.1.1")
]
}
errors = client.create_batch_change(batch_change_input, status=400)
assert_that(errors, is_("Batch change requires owner group for manual review/scheduled changes."))
def test_create_batch_change_with_updates_deletes_success(shared_zone_test_context):
"""
Test successfully creating a batch change with updates and deletes

View File

@@ -12,7 +12,8 @@ def test_reject_pending_batch_change_success(shared_zone_test_context):
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'])