Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 def setUp(self):
     self.User = UserFactory._meta.model
     self.Profile = ProfileFactory._meta.model
     self.list_user = []
     for i in range(NUMBER_OF_SAMPLE):
         temp_user = UserFactory(
             title=title_list[randint(0,
                                      len(title_list) - 1)])
         _ = ProfileFactory(
             user=temp_user,
             name=name_list[randint(0,
                                    len(name_list) - 1)],
             birth_day=birthday_list[randint(0,
                                             len(birthday_list) - 1)],
             gender=gender_list[randint(0,
                                        len(gender_list) - 1)],
             join_date=joindate_list[randint(0,
                                             len(joindate_list) - 1)],
         )
         self.list_user.append(temp_user)
     self.authentication = authentication(self, staff=True)
     self.client.credentials(HTTP_AUTHORIZATION=self.authentication[0])
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def test_user_get_invalid_contact(self):
     temp_user = UserFactory.build()
     url = reverse('contact-detail', kwargs={'pk': temp_user.id})
     response = self.client.get(url)
     self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)