2
2
from django .http import HttpRequest
3
3
from ..views import SignupView
4
4
from app import settings
5
-
5
+ from api . tests . test_config import setenv
6
6
7
7
@override_settings (STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' )
8
8
class AddCSSTemplateTagTest (SimpleTestCase ):
9
9
10
10
def test_rendered (self ):
11
+ with setenv ('ALLOW_SIGNUP' , 'True' ):
11
12
request = HttpRequest ()
12
13
request .method = 'GET'
13
14
needle = '<input type="password" name="password1" class=" input" required id="id_password1">'
@@ -19,6 +20,7 @@ class ViewsTest(SimpleTestCase):
19
20
"""Class for testing views"""
20
21
21
22
def test_mail_not_set_up (self ):
23
+ with setenv ('ALLOW_SIGNUP' , 'True' ):
22
24
if hasattr (settings , 'EMAIL_HOST' ):
23
25
has_EMAIL_HOST = True
24
26
EMAIL_HOST = settings .EMAIL_HOST
@@ -45,6 +47,7 @@ def test_mail_not_set_up(self):
45
47
self .assertInHTML (needle , str (response .content ))
46
48
47
49
def test_signup_not_allowed (self ):
50
+ with setenv ('ALLOW_SIGNUP' , 'True' ):
48
51
ALLOW_SIGNUP = settings .ALLOW_SIGNUP
49
52
settings .ALLOW_SIGNUP = False
50
53
request = HttpRequest ()
@@ -59,6 +62,7 @@ class ViewsDBTest(TestCase):
59
62
"""Class for testing views with DB queries"""
60
63
61
64
def test_form_submission (self ):
65
+ with setenv ('ALLOW_SIGNUP' , 'True' ):
62
66
self .factory = RequestFactory ()
63
67
if hasattr (settings , 'EMAIL_BACKEND' ):
64
68
EMAIL_BACKEND = settings .EMAIL_BACKEND
0 commit comments