22from django .http import HttpRequest
33from ..views import SignupView
44from app import settings
5-
5+ from api . tests . test_config import setenv
66
77@override_settings (STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage' )
88class AddCSSTemplateTagTest (SimpleTestCase ):
99
1010 def test_rendered (self ):
11+ with setenv ('ALLOW_SIGNUP' , 'True' ):
1112 request = HttpRequest ()
1213 request .method = 'GET'
1314 needle = '<input type="password" name="password1" class=" input" required id="id_password1">'
@@ -19,6 +20,7 @@ class ViewsTest(SimpleTestCase):
1920 """Class for testing views"""
2021
2122 def test_mail_not_set_up (self ):
23+ with setenv ('ALLOW_SIGNUP' , 'True' ):
2224 if hasattr (settings , 'EMAIL_HOST' ):
2325 has_EMAIL_HOST = True
2426 EMAIL_HOST = settings .EMAIL_HOST
@@ -45,6 +47,7 @@ def test_mail_not_set_up(self):
4547 self .assertInHTML (needle , str (response .content ))
4648
4749 def test_signup_not_allowed (self ):
50+ with setenv ('ALLOW_SIGNUP' , 'True' ):
4851 ALLOW_SIGNUP = settings .ALLOW_SIGNUP
4952 settings .ALLOW_SIGNUP = False
5053 request = HttpRequest ()
@@ -59,6 +62,7 @@ class ViewsDBTest(TestCase):
5962 """Class for testing views with DB queries"""
6063
6164 def test_form_submission (self ):
65+ with setenv ('ALLOW_SIGNUP' , 'True' ):
6266 self .factory = RequestFactory ()
6367 if hasattr (settings , 'EMAIL_BACKEND' ):
6468 EMAIL_BACKEND = settings .EMAIL_BACKEND
0 commit comments