more api tests (mostly triggering execution of some code)

it's hard to test anything without a user / http auth / login / session.
This commit is contained in:
Thomas Waldmann 2013-11-15 13:00:57 +01:00
parent 1f28cb3ed0
commit 4c46c30d25
2 changed files with 19 additions and 3 deletions

View File

@ -14,5 +14,21 @@ def test_myip(client):
def test_nic_update(client):
response = client.get(reverse('update'))
response = client.get(reverse('nic_update'))
assert response.status_code == 401
def test_nic_update_session(client):
response = client.get(reverse('nic_update_authorized'))
assert response.status_code == 302 # redirects to login view
def test_detect_ip(client):
response = client.get(reverse('detectip', args=('invalid_session_id', )))
assert response.status_code == 204
def test_ajax_get_ips(client):
response = client.get(reverse('ajax_get_ips'))
assert response.status_code == 200

View File

@ -24,12 +24,12 @@ urlpatterns = patterns(
url(r'^domain_overview/$', DomainOverwievView.as_view(), name='domain_overview'),
url(r'^domain/(?P<pk>\d+)/delete/$', DeleteDomainView.as_view(), name='delete_domain'),
# internal use by the web ui
url(r'^detectip/(?P<sessionid>\w+)/$', DetectIpView.as_view()),
url(r'^detectip/(?P<sessionid>\w+)/$', DetectIpView.as_view(), name='detectip'),
url(r'^ajax_get_ips/$', AjaxGetIps.as_view(), name="ajax_get_ips"),
url(r'^nic/update_authorized$', AuthorizedNicUpdateView.as_view(), name='nic_update_authorized'),
# api (for update clients)
url(r'^myip$', myip_view, name='myip'),
url(r'^nic/update$', NicUpdateView.as_view(), name='update'),
url(r'^nic/update$', NicUpdateView.as_view(), name='nic_update'),
# for bots
url(r'^robots.txt$', RobotsTxtView.as_view()),
)