Ejemplo n.º 1
0
 def test_create_organization_with_nonexistent_slug(self):
     data = {
         'name': 'My New Organization',
         'email': '*****@*****.**',
     }
     form = forms.OrganizationSignupForm(data, user=self.user)
     self.assertTrue(form.is_valid())
Ejemplo n.º 2
0
 def test_create_organization_with_big_name(self):
     data = {
         'name': 'a' * 33,
         'email': '*****@*****.**',
     }
     form = forms.OrganizationSignupForm(data, user=self.user)
     self.assertFalse(form.is_valid())
     self.assertIn('at most 32 characters', form.errors['name'][0])
Ejemplo n.º 3
0
 def test_create_organization_with_existent_slug(self):
     data = {
         'name': 'mozilla',
         'email': '*****@*****.**',
     }
     form = forms.OrganizationSignupForm(data, user=self.user)
     # there is already an organization with the slug ``mozilla`` (lowercase)
     self.assertFalse(form.is_valid())
Ejemplo n.º 4
0
 def test_create_organization_with_empy_slug(self):
     data = {
         'name': '往事',
         'email': '*****@*****.**',
     }
     form = forms.OrganizationSignupForm(data, user=self.user)
     self.assertFalse(form.is_valid())
     self.assertEqual('Invalid organization name: no slug generated',
                      form.errors['name'][0])