Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Add tests for registration form configuration

Roland Geider850e00758326
diff --git a/wger/core/tests/test_registration.py b/wger/core/tests/test_registration.py
index aff67e020..7d0e0111e 100644
--- a/wger/core/tests/test_registration.py
+++ b/wger/core/tests/test_registration.py
@@ -16,6 +16,8 @@ import logging
from django.core.urlresolvers import reverse
from django.contrib.auth.models import User
+from wger.core.forms import RegistrationForm
+from wger.core.forms import RegistrationFormNoCaptcha
from wger.manager.tests.testcase import WorkoutManagerTestCase
@@ -27,6 +29,19 @@ class RegistrationTestCase(WorkoutManagerTestCase):
Tests registering a new user
'''
+ def test_registration_captcha(self):
+ '''
+ Tests that the correct form is used depending on global
+ configuration settings
+ '''
+ with self.settings(WGER_SETTINGS={'USE_RECAPTCHA': True}):
+ response = self.client.get(reverse('core:user:registration'))
+ self.assertIsInstance(response.context['form'], RegistrationForm)
+
+ with self.settings(WGER_SETTINGS={'USE_RECAPTCHA': False}):
+ response = self.client.get(reverse('core:user:registration'))
+ self.assertIsInstance(response.context['form'], RegistrationFormNoCaptcha)
+
def test_register(self):
# Fetch the registration page