From b718b9345385017b76dd0ad95d61ce706c151c37 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 18 Dec 2013 03:50:41 +0100 Subject: [PATCH] test more main views, exclude csrf failure view from coverage --- nsupdate/main/_tests/test_main.py | 6 ++++++ nsupdate/main/views.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nsupdate/main/_tests/test_main.py b/nsupdate/main/_tests/test_main.py index 6c3229f..ea211e7 100644 --- a/nsupdate/main/_tests/test_main.py +++ b/nsupdate/main/_tests/test_main.py @@ -25,6 +25,9 @@ def test_views_anon(client): ('generate_ns_secret_view', dict(pk=1), 302), ('delete_host', dict(pk=1), 302), ('delete_domain', dict(pk=1), 302), + ('updater_hostconfig_overview', dict(pk=1), 302), + ('updater_hostconfig', dict(pk=1), 302), + ('delete_updater_hostconfig', dict(pk=1), 302), # interactive updater shows http basic auth popup ('update', dict(), 401), ]: @@ -49,6 +52,9 @@ def test_views_logged_in(client): ('generate_ns_secret_view', dict(pk=1), 200), ('delete_host', dict(pk=1), 200), ('delete_domain', dict(pk=1), 200), + ('updater_hostconfig_overview', dict(pk=1), 200), + ('updater_hostconfig', dict(pk=1), 200), + ('delete_updater_hostconfig', dict(pk=1), 200), ('update', dict(), 401), ]: print view, kwargs, status_code diff --git a/nsupdate/main/views.py b/nsupdate/main/views.py index 775bd16..206ef70 100644 --- a/nsupdate/main/views.py +++ b/nsupdate/main/views.py @@ -458,7 +458,7 @@ Disallow: /updater_hostconfig_overview/ return HttpResponse(content, content_type="text/plain") -def csrf_failure_view(request, reason): +def csrf_failure_view(request, reason): # pragma: no cover (hard to test) """ Django's CSRF middleware's builtin view doesn't tell the user that he needs to have cookies enabled.