Skip to content

Commit

Permalink
Version bump (#292)
Browse files Browse the repository at this point in the history
* Test against latest django versions and python 3.6

* Make use of override_settings

* Prep for 1.8 release
  • Loading branch information
joshblum authored Oct 4, 2017
1 parent bfd0460 commit e9b314d
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 115 deletions.
15 changes: 11 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,28 @@ python:
- 3.3
- 3.4
- 3.5
- 3.6

env:
- DJANGO=Django==1.8.18
- DJANGO=Django==1.9.13
- DJANGO=Django==1.10.7
- DJANGO=Django==1.11.4
- DJANGO=Django==1.10.8
- DJANGO=Django==1.11.5

matrix:
exclude:
- python: 3.3
env: DJANGO=Django==1.9.13
- python: 3.3
env: DJANGO=Django==1.10.7
env: DJANGO=Django==1.10.8
- python: 3.3
env: DJANGO=Django==1.11.4
env: DJANGO=Django==1.11.5
- python: 3.6
env: DJANGO=Django==1.8.18
- python: 3.6
env: DJANGO=Django==1.9.13
- python: 3.6
env: DJANGO=Django==1.10.8

install:
- pip install -r requirements.txt
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
django-registration-redux changelog
===================================

Version 1.8, TBD
Version 1.8, 03 October, 2017
----------------
* Bugfix: Add outlook.com to the list of free email providers. -
* Bugfix: Add `outlook.com` to the list of free email providers. -
`#287 <https://github.com/macropin/django-registration/pull/287>_`
* Documentation: Add possible settings for activation emails. -
`#283 <https://github.com/macropin/django-registration/pull/282>_`
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@

# General information about the project.
project = u'django-registration-redux'
copyright = u'2007-2013, James Bennett. 2014, Andrew Cutler and others.'
copyright = u'2007-2013, James Bennett. 2014-2017, Andrew Cutler and others.'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.7'
version = '1.8'
# The full version, including alpha/beta/rc tags.
release = '1.7'
release = '1.8'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
7 changes: 6 additions & 1 deletion docs/upgrade.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ Django version requirement

As of |version|, |project| requires Django 1.8 or newer;
older Django releases may work, but are officially unsupported. Additionally,
|project| officially supports Python 2.7, 3.3, 3.4, and 3.5.
|project| officially supports Python 2.7, 3.3, 3.4, 3.5, and 3.6.


Backwards-incompatible changes
------------------------------

Version 1.8
```````````

- None

Version 1.7
```````````

Expand Down
2 changes: 1 addition & 1 deletion registration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = (1, 7, 0, 'final', 0)
VERSION = (1, 8, 0, 'final', 0)


def get_version():
Expand Down
35 changes: 11 additions & 24 deletions registration/tests/admin_actions.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,33 @@
from __future__ import unicode_literals

from django.conf import settings
from django.contrib.admin import helpers
from django.core import mail, urlresolvers
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
from registration.models import RegistrationProfile
from registration.users import UserModel


@override_settings(ACCOUNT_ACTIVATION_DAYS=7,
REGISTRATION_DEFAULT_FROM_EMAIL='[email protected]',
REGISTRATION_EMAIL_HTML=True,
DEFAULT_FROM_EMAIL='[email protected]')
class AdminCustomActionsTestCase(TestCase):
"""
Test the available admin custom actions
"""

def setUp(self):
self.client = Client()
admin_user = UserModel().objects.create_superuser('admin', '[email protected]', 'admin')
admin_user = UserModel().objects.create_superuser(
'admin', '[email protected]', 'admin')
self.client.login(username=admin_user.username, password=admin_user)

self.user_info = {'username': 'alice',
'password': 'swordfish',
'email': '[email protected]'}

self.old_activation = getattr(settings,
'ACCOUNT_ACTIVATION_DAYS', None)
self.old_reg_email = getattr(settings,
'REGISTRATION_DEFAULT_FROM_EMAIL', None)
self.old_email_html = getattr(settings,
'REGISTRATION_EMAIL_HTML', None)
self.old_django_email = getattr(settings,
'DEFAULT_FROM_EMAIL', None)

settings.ACCOUNT_ACTIVATION_DAYS = 7
settings.REGISTRATION_DEFAULT_FROM_EMAIL = '[email protected]'
settings.REGISTRATION_EMAIL_HTML = True
settings.DEFAULT_FROM_EMAIL = '[email protected]'

def tearDown(self):
settings.ACCOUNT_ACTIVATION_DAYS = self.old_activation
settings.REGISTRATION_DEFAULT_FROM_EMAIL = self.old_reg_email
settings.REGISTRATION_EMAIL_HTML = self.old_email_html
settings.DEFAULT_FROM_EMAIL = self.old_django_email

def test_activate_users(self):
"""
Test the admin custom command 'activate users'
Expand All @@ -53,7 +38,8 @@ def test_activate_users(self):

self.assertFalse(profile.activated)

registrationprofile_list = urlresolvers.reverse('admin:registration_registrationprofile_changelist')
registrationprofile_list = urlresolvers.reverse(
'admin:registration_registrationprofile_changelist')
post_data = {
'action': 'activate_users',
helpers.ACTION_CHECKBOX_NAME: [profile.pk],
Expand All @@ -70,7 +56,8 @@ def test_resend_activation_email(self):
new_user = UserModel().objects.create_user(**self.user_info)
profile = RegistrationProfile.objects.create_profile(new_user)

registrationprofile_list = urlresolvers.reverse('admin:registration_registrationprofile_changelist')
registrationprofile_list = urlresolvers.reverse(
'admin:registration_registrationprofile_changelist')
post_data = {
'action': 'resend_activation_email',
helpers.ACTION_CHECKBOX_NAME: [profile.pk],
Expand Down
37 changes: 7 additions & 30 deletions registration/tests/default_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
from registration.users import UserModel


@override_settings(ROOT_URLCONF='test_app.urls_default')
@override_settings(ROOT_URLCONF='test_app.urls_default',
ACCOUNT_ACTIVATION_DAYS=7)
class DefaultBackendViewTests(TestCase):
"""
Test the default registration backend.
Expand All @@ -30,40 +31,18 @@ class DefaultBackendViewTests(TestCase):

registration_view = RegistrationView

def setUp(self):
"""
Create an instance of the default backend for use in testing,
and set ``ACCOUNT_ACTIVATION_DAYS`` if it's not set already.
"""
self.old_activation = getattr(settings,
'ACCOUNT_ACTIVATION_DAYS', None)
if self.old_activation is None:
settings.ACCOUNT_ACTIVATION_DAYS = 7 # pragma: no cover

def tearDown(self):
"""
Yank ``ACCOUNT_ACTIVATION_DAYS`` back out if it wasn't
originally set.
"""
if self.old_activation is None:
# pragma: no cover
settings.ACCOUNT_ACTIVATION_DAYS = self.old_activation

def test_allow(self):
@override_settings(REGISTRATION_OPEN=True)
def test_registration_open(self):
"""
The setting ``REGISTRATION_OPEN`` appropriately controls
whether registration is permitted.
"""
old_allowed = getattr(settings, 'REGISTRATION_OPEN', True)
settings.REGISTRATION_OPEN = True

resp = self.client.get(reverse('registration_register'))
self.assertEqual(200, resp.status_code)

settings.REGISTRATION_OPEN = False
@override_settings(REGISTRATION_OPEN=False)
def test_registration_closed(self):

# Now all attempts to hit the register view should redirect to
# the 'registration is closed' message.
Expand All @@ -77,8 +56,6 @@ def test_allow(self):
'password2': 'secret'})
self.assertRedirects(resp, reverse('registration_disallowed'))

settings.REGISTRATION_OPEN = old_allowed

def test_registration_get(self):
"""
HTTP ``GET`` to the registration view uses the appropriate
Expand All @@ -90,7 +67,7 @@ def test_registration_get(self):
self.assertTemplateUsed(resp,
'registration/registration_form.html')
self.failUnless(isinstance(resp.context['form'],
RegistrationForm))
RegistrationForm))

def test_registration(self):
"""
Expand Down
9 changes: 3 additions & 6 deletions registration/tests/forms_custom_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,25 @@
pass # Python 2 reload()


from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings

from registration import forms
from registration.users import UsernameField


@override_settings(AUTH_USER_MODEL='test_app.CustomUser')
class RegistrationFormTests(TestCase):
"""
Test the default registration forms.
"""

def setUp(self):
self.old_auth_model = getattr(settings, 'AUTH_USER_MODEL', None)
settings.AUTH_USER_MODEL = 'test_app.CustomUser'
# The form's Meta class is created on import. We have to reload()
# to apply the new AUTH_USER_MODEL to the Meta class.
reload(forms)

def tearDown(self):
settings.AUTH_USER_MODEL = self.old_auth_model

def test_registration_form_adds_custom_user_name_field(self):
"""
Test that ``RegistrationForm`` adds custom username
Expand Down
Loading

0 comments on commit e9b314d

Please sign in to comment.