diff --git a/core/tests.py b/core/tests.py index 8dee31c..1b1a9f0 100644 --- a/core/tests.py +++ b/core/tests.py @@ -41,7 +41,7 @@ class CustomUserViewSetTest(APITestCase): self.user = self.factory(email=self.reg_email, password=self.password, is_active=True) # anon user - def test_anon_user_can_create_active_instance(self): + def test_anon_user_can_create_inactive_instance(self): """Not logged-in user can create new instance of User but it's inactive """ data = { @@ -57,7 +57,7 @@ class CustomUserViewSetTest(APITestCase): self.assertEqual(response.status_code, status.HTTP_201_CREATED) # assert instance is inactive info = json.loads(response.content) - self.assertTrue(info['is_active']) + self.assertFalse(info['is_active']) # Assert instance exists on db self.assertTrue(self.model.objects.get(email=info['email'])) # assert verification email @@ -634,6 +634,8 @@ class CreateCompanyUserTest(APITestCase): self.assertTrue(self.model.objects.get(email='test@email.com')) self.assertFalse(self.model.objects.get(email='test@email.com').is_active) self.assertTrue(Company.objects.get(cif='qwerewq')) + # assert verification email + self.assertTrue(len(mail.outbox) == 1) def test_creation_error(self):