Пример #1
0
 def test_user_already_exists_username(self):
     UserFactory.create(username=self.username)
     with self.assertRaisesRegex(
             CommandError, 'User {} already exists'.format(self.username)):
         call_command(self.command, self.username, email=self.email)
Пример #2
0
 def test_user_already_exists_email(self):
     UserFactory.create(email=self.email)
     call_command(self.command, self.username, email=self.email)
     user = User.objects.get(username=self.username)
     self.assert_user(user, expected_email=self.email)