def setUp(self): self.Team = Team._meta.model self.authentication = authentication(self, staff=True) self.user = self.authentication[1] self.pm = UserFactory.create() self.pm_profile = ProfileFactory(user=self.pm) self.member = UserFactory.create() self.memberProfile = ProfileFactory(user=self.member) self.client.credentials(HTTP_AUTHORIZATION=self.authentication[0]) self.team = TeamFactory.create(team_name=factory.Faker('name'), team_email=factory.Faker('email'), team_leader=self.user)
def setUp(self): self.User = UserFactory._meta.model self.Profile = ProfileFactory._meta.model self.authentication = authentication(self, staff=True) self.client.credentials(HTTP_AUTHORIZATION=self.authentication[0]) self.user = self.authentication[1] self.user_profile = self.Profile.objects.get(user=self.user) self.manager = UserFactory.create() self.manager_profile = ProfileFactory.create(user=self.manager)
def test_user_create_invalid_contact(self): temp_user = UserFactory.create() url = reverse('contact-add', kwargs={'pk': temp_user.id}) response = self.client.post(url, self.invalid_data) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)