コード例 #1
0
ファイル: registration.py プロジェクト: mmilewski/entelib
    def test_only_admin_can_add_user(self):
        self.log_user()
        response = self.client.get(self.add_user_url, follow=True)
        self.assertFalse(utils.accessed(response))

        self.log_lib()
        response = self.client.get(self.add_user_url, follow=True)
        self.assertFalse(utils.accessed(response))

        self.log_admin()
        response = self.client.get(self.add_user_url, follow=True)
        self.assertTrue(utils.accessed(response))
コード例 #2
0
    def test_only_admin_can_add_user(self):
        self.log_user()
        response = self.client.get(self.add_user_url, follow=True)
        self.assertFalse(utils.accessed(response))

        self.log_lib()
        response = self.client.get(self.add_user_url, follow=True)
        self.assertFalse(utils.accessed(response))

        self.log_admin()
        response = self.client.get(self.add_user_url, follow=True)
        self.assertTrue(utils.accessed(response))
コード例 #3
0
ファイル: registration.py プロジェクト: mmilewski/entelib
 def test_user_form_displayed(self):
     self.log_admin()
     response = self.client.get(self.add_user_url, follow=True)
     self.assert_(utils.accessed(response))
     fields = response.context["form_content"].base_fields
     self.assert_("first_name" in fields)
     self.assert_("last_name" in fields)
     self.assert_("email" in fields)
     self.assert_("password1" in fields)
     self.assert_("password2" in fields)
コード例 #4
0
 def test_user_form_displayed(self):
     self.log_admin()
     response = self.client.get(self.add_user_url, follow=True)
     self.assert_(utils.accessed(response))
     fields = response.context['form_content'].base_fields
     self.assert_('first_name' in fields)
     self.assert_('last_name' in fields)
     self.assert_('email' in fields)
     self.assert_('password1' in fields)
     self.assert_('password2' in fields)
コード例 #5
0
ファイル: registration.py プロジェクト: mmilewski/entelib
 def test_new_user_registered(self):
     self.log_admin()
     email = "*****@*****.**"
     first_name, last_name = "Jan", "Nowak"
     data = {
         "first_name": first_name,
         "last_name": last_name,
         "username": "******",
         "email": email,
         "password1": "superpassword",
         "password2": "superpassword",
     }
     response = self.client.post(self.add_user_url, data)
     self.assert_(utils.accessed(response))
     self.assert_(utils.no_form_errors_happened(response.content))
     u = User.objects.get(email=email)
     self.assert_(u.first_name == first_name)
     self.assert_(u.last_name == last_name)
     self.assert_(u.is_active == True)
     self.assert_(u.userprofile.awaits_activation == True)
コード例 #6
0
ファイル: registration.py プロジェクト: mmilewski/entelib
 def test_fresh_new_user_registered(self):
     self.logout()
     email = "*****@*****.**"
     first_name, last_name = "Nowy", "User12374hov21fiu3"
     data = {
         "first_name": first_name,
         "last_name": last_name,
         "username": "******",
         "email": email,
         "password1": "superpassword",
         "password2": "superpassword",
     }
     response = self.client.post(self.new_user_url, data)
     self.assert_(utils.accessed(response))
     self.assert_(utils.no_form_errors_happened(response.content))
     u = User.objects.get(email=email)
     self.assert_(u.first_name == first_name)
     self.assert_(u.last_name == last_name)
     self.assert_(u.is_active == False)
     self.assert_(u.userprofile.awaits_activation == True)
コード例 #7
0
 def test_new_user_registered(self):
     self.log_admin()
     email = '*****@*****.**'
     first_name, last_name = 'Jan', 'Nowak'
     data = {
         'first_name': first_name,
         'last_name': last_name,
         'username': '******',
         'email': email,
         'password1': 'superpassword',
         'password2': 'superpassword',
     }
     response = self.client.post(self.add_user_url, data)
     self.assert_(utils.accessed(response))
     self.assert_(utils.no_form_errors_happened(response.content))
     u = User.objects.get(email=email)
     self.assert_(u.first_name == first_name)
     self.assert_(u.last_name == last_name)
     self.assert_(u.is_active == True)
     self.assert_(u.userprofile.awaits_activation == True)
コード例 #8
0
 def test_fresh_new_user_registered(self):
     self.logout()
     email = '*****@*****.**'
     first_name, last_name = 'Nowy', 'User12374hov21fiu3'
     data = {
         'first_name': first_name,
         'last_name': last_name,
         'username': '******',
         'email': email,
         'password1': 'superpassword',
         'password2': 'superpassword',
     }
     response = self.client.post(self.new_user_url, data)
     self.assert_(utils.accessed(response))
     self.assert_(utils.no_form_errors_happened(response.content))
     u = User.objects.get(email=email)
     self.assert_(u.first_name == first_name)
     self.assert_(u.last_name == last_name)
     self.assert_(u.is_active == False)
     self.assert_(u.userprofile.awaits_activation == True)