From 56bddb83b60710b940d345b7e072d3431f941147 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 27 Aug 2014 16:45:05 +0200 Subject: [PATCH] fix broken api test as we first check for a nochg update, we couldn't always get the expected dnserr here as the dns update is tried after the nochg check. so, if the address did not change, the test failed. fixed by making sure it is not a nochg update. --- nsupdate/api/_tests/test_api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nsupdate/api/_tests/test_api.py b/nsupdate/api/_tests/test_api.py index d5bf501..982c7d9 100644 --- a/nsupdate/api/_tests/test_api.py +++ b/nsupdate/api/_tests/test_api.py @@ -83,7 +83,12 @@ def test_nic_update_authorized_ns_unavailable(client): d = Domain.objects.get(domain=TESTDOMAIN) d.available = False # simulate DNS unavailability d.save() - response = client.get(reverse('nic_update'), + # prepare: we must make sure the real test is not a nochg update + response = client.get(reverse('nic_update') + '?myip=1.2.3.4', + HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET)) + assert response.status_code == 200 + # now do the real test: ip changed, but we can't update DNS as it is unavailable + response = client.get(reverse('nic_update') + '?myip=4.3.2.1', HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET)) assert response.status_code == 200 assert response.content == b'dnserr'