diff --git a/.travis.yml b/.travis.yml index fa5c702..be30c4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,23 +23,23 @@ env: - TEST_OPTS="" - COVERAGE="" matrix: - - DJANGO=1.8.1 + - DJANGO=1.11 matrix: exclude: - python: "2.7" - env: DJANGO=1.8.1 + env: DJANGO=1.11 - python: "3.6" - env: DJANGO=1.8.1 - - python: "3.6-dev" - env: DJANGO=1.8.1 - include: - - python: "2.7" - env: DJANGO=1.8.1 COVERAGE="coverage run -m" TEST_K="not ddns_client" TEST_OPTS="--pep8" - - python: "3.6" - env: DJANGO=1.8.18 + env: DJANGO=1.11 - python: "3.6-dev" env: DJANGO=1.11 + include: + - python: "2.7" + env: DJANGO=1.11 COVERAGE="coverage run -m" TEST_K="not ddns_client" TEST_OPTS="--pep8" + - python: "3.6" + env: DJANGO=1.11 + - python: "3.6-dev" + env: DJANGO=2.0 install: - ./scripts/travis/install.sh diff --git a/nsupdate/accounts/_tests/test_accounts.py b/nsupdate/accounts/_tests/test_accounts.py index e585bf3..90a3080 100644 --- a/nsupdate/accounts/_tests/test_accounts.py +++ b/nsupdate/accounts/_tests/test_accounts.py @@ -6,8 +6,7 @@ from __future__ import print_function import pytest -from django.core.urlresolvers import reverse - +from django.urls import reverse USERNAME = 'test' PASSWORD = 'pass' @@ -29,17 +28,16 @@ def test_views_anon(client): assert response.status_code == status_code -def test_views_logged_in(client): - client.login(username=USERNAME, password=PASSWORD) - for view, kwargs, status_code in [ - ('account_profile', dict(), 200), - ('account_settings', dict(), 200), - ('account_delete', dict(), 200), - ('registration_disallowed', dict(), 200), - ('registration_complete', dict(), 200), - ('registration_register', dict(), 200), - ('registration_activation_complete', dict(), 200), - ]: - print("%s, %s, %s" % (view, kwargs, status_code)) - response = client.get(reverse(view, kwargs=kwargs)) - assert response.status_code == status_code +@pytest.mark.parametrize("view,view_kwargs,status_code", ( + ('account_profile', dict(), 200), + ('account_settings', dict(), 200), + ('account_delete', dict(), 200), + ('registration_disallowed', dict(), 200), + ('registration_complete', dict(), 200), + ('registration_register', dict(), 302), + ('registration_activation_complete', dict(), 200), +)) +def test_views_logged_in(client, view, view_kwargs, status_code): + assert client.login(username=USERNAME, password=PASSWORD) + response = client.get(reverse(view, kwargs=view_kwargs)) + assert response.status_code == status_code diff --git a/nsupdate/accounts/models.py b/nsupdate/accounts/models.py index 8da8e06..50e35c6 100644 --- a/nsupdate/accounts/models.py +++ b/nsupdate/accounts/models.py @@ -19,7 +19,7 @@ class UserProfile(models.Model): stuff we need additionally to what Django stores in User model """ user = models.OneToOneField(settings.AUTH_USER_MODEL, primary_key=True, related_name='profile', - verbose_name=_('user')) + verbose_name=_('user'), on_delete=models.CASCADE) language = models.CharField(max_length=10, choices=settings.LANGUAGES, default='', blank=True, null=True, verbose_name=_('language')) diff --git a/nsupdate/accounts/templates/accounts/user_settings_account.html b/nsupdate/accounts/templates/accounts/user_settings_account.html index 520d611..d673277 100644 --- a/nsupdate/accounts/templates/accounts/user_settings_account.html +++ b/nsupdate/accounts/templates/accounts/user_settings_account.html @@ -14,7 +14,7 @@ {{ form|bootstrap_horizontal:"col-sm-3 col-lg-3" }}
diff --git a/nsupdate/accounts/urls.py b/nsupdate/accounts/urls.py index f996398..22f2676 100644 --- a/nsupdate/accounts/urls.py +++ b/nsupdate/accounts/urls.py @@ -1,4 +1,3 @@ -from django.conf.urls import patterns from django.conf.urls import url from django.views.generic.base import TemplateView @@ -8,8 +7,7 @@ from registration.backends.default.views import RegistrationView from .views import UserProfileView, DeleteUserView, UserChangePasswordView -urlpatterns = patterns( - '', +urlpatterns = ( url(r'^profile/', UserProfileView.as_view(), name="account_profile"), url(r'^settings/', UserChangePasswordView.as_view(), name='account_settings'), url(r'^delete/', DeleteUserView.as_view(), name="account_delete"), diff --git a/nsupdate/accounts/views.py b/nsupdate/accounts/views.py index 4ccbcb2..a02da32 100644 --- a/nsupdate/accounts/views.py +++ b/nsupdate/accounts/views.py @@ -7,7 +7,7 @@ from django.contrib.auth.decorators import login_required from django.utils.decorators import method_decorator from django.views.decorators.csrf import csrf_protect from django.views.decorators.debug import sensitive_post_parameters -from django.core.urlresolvers import reverse, reverse_lazy +from django.urls import reverse, reverse_lazy from django.shortcuts import redirect from django.contrib import messages from django.utils.translation import ugettext_lazy as _ diff --git a/nsupdate/api/_tests/test_api.py b/nsupdate/api/_tests/test_api.py index 3d514ac..f6e072b 100644 --- a/nsupdate/api/_tests/test_api.py +++ b/nsupdate/api/_tests/test_api.py @@ -7,7 +7,7 @@ import pytest import base64 from netaddr import IPSet, IPAddress, IPNetwork -from django.core.urlresolvers import reverse +from django.urls import reverse from nsupdate.main.dnstools import query_ns, FQDN from nsupdate.main.models import Domain diff --git a/nsupdate/login/templates/login.html b/nsupdate/login/templates/login.html index 2a75f7d..ebe9cf8 100644 --- a/nsupdate/login/templates/login.html +++ b/nsupdate/login/templates/login.html @@ -10,7 +10,7 @@ {% if form.errors %}{% trans "Your username and password didn't match. Please try again." %}
{% endif %} -