-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test against latest django versions and python 3.6 * Make use of override_settings * Prep for 1.8 release
- Loading branch information
Showing
10 changed files
with
65 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
|
@@ -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], | ||
|
@@ -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], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.