add tests for update/delete api with invalid IPs

This commit is contained in:
Thomas Waldmann 2014-09-02 23:50:39 +02:00
parent 9bd09b6008
commit 8738b135fc

View File

@ -72,6 +72,20 @@ def test_nic_update_authorized_not_fqdn_username(client):
assert response.content == b'notfqdn'
def test_nic_update_authorized_invalid_ip1(client):
response = client.get(reverse('nic_update') + '?myip=1234',
HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET))
assert response.status_code == 200
assert response.content == b'dnserr'
def test_nic_update_authorized_invalid_ip2(client):
response = client.get(reverse('nic_update') + '?myip=%C3%A4%C3%BC%C3%B6',
HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET))
assert response.status_code == 200
assert response.content == b'dnserr'
def test_nic_update_authorized(client):
response = client.get(reverse('nic_update'),
HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET))
@ -184,6 +198,20 @@ def test_nic_update_session_foreign_host(client):
assert response.content == b'nohost'
def test_nic_delete_authorized_invalid_ip1(client):
response = client.get(reverse('nic_delete') + '?myip=1234',
HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET))
assert response.status_code == 200
assert response.content == b'dnserr'
def test_nic_delete_authorized_invalid_ip2(client):
response = client.get(reverse('nic_delete') + '?myip=%C3%A4%C3%BC%C3%B6',
HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET))
assert response.status_code == 200
assert response.content == b'dnserr'
def test_nic_delete_authorized(client):
response = client.get(reverse('nic_update') + '?myip=%s' % ('1.2.3.4', ),
HTTP_AUTHORIZATION=make_basic_auth_header(TEST_HOST, TEST_SECRET))