Esempio n. 1
0
    def test_worker_profile_and_comm_edit(self):
        self.c.login(username='******', password='******')
        response = self.c.put('/worker_profile/worker_profile/{}/'.format(
            self.worker.id),
                              data={
                                  'first_name': 'testtest',
                                  'second_name': 'testtesttest',
                                  'position': 'admin',
                                  'phone_number': '+222222222222',
                                  'email': '*****@*****.**',
                                  'worker': self.user.id,
                              })

        dump.dump(response)
        self.assertEqual(response.status_code, status.HTTP_200_OK)

        response1 = self.c.put(
            '/worker_profile/worker_profile/worker_communications/{}/'.format(
                self.worker_comm.id),
            data={
                "id": self.worker_comm.id,
                "worker_profile": self.worker_comm.worker_profile.id,
                "social_network": self.worker_comm.social_network,
                "social_networks_ids": "@zazazaza"
            })
        dump.dump(response1)
        self.assertEqual(response1.status_code, status.HTTP_200_OK)
Esempio n. 2
0
    def test_worker_communications_list(self):
        response = self.c.get(
            '/worker_profile/worker_profile/worker_communications/')

        self.assertEqual(response.status_code, status.HTTP_200_OK)

        dump.dump(response)
        self.assertEqual(
            response.data, {
                "count":
                1,
                "next":
                None,
                "previous":
                None,
                "results": [
                    {
                        "id": self.worker_comm.id,
                        "worker_profile": self.worker_comm.worker_profile.id,
                        "social_network": self.worker_comm.social_network,
                        "social_networks_ids":
                        self.worker_comm.social_networks_ids
                    },
                ]
            })
Esempio n. 3
0
    def test_worker_profile_details(self):
        self.c.login(username='******', password='******')

        response = self.c.get('/worker_profile/worker_profile/1/')

        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
        dump.dump(response)
Esempio n. 4
0
    def test_worker_communications_delete(self):
        self.c.login(username='******', password='******')
        response1 = self.c.delete(
            '/worker_profile/worker_profile/worker_communications/{}/'.format(
                self.worker_comm.id))

        dump.dump(response1)
        self.assertEqual(response1.status_code, status.HTTP_204_NO_CONTENT)
Esempio n. 5
0
    def test_worker_profile_delete(self):
        self.c.login(username='******', password='******')
        response = self.c.delete(
            '/worker_profile/worker_profile/{}/'.format(self.worker.id), )

        dump.dump(response)
        self.assertEqual(response.status_code,
                         status.HTTP_405_METHOD_NOT_ALLOWED)
Esempio n. 6
0
    def test_worker_communications_details_permission(self):
        self.c.login(username='******', password='******')

        response = self.c.get(
            '/worker_profile/worker_profile/worker_communications/{}/'.format(
                self.worker_comm.id))
        dump.dump(response)
        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
Esempio n. 7
0
 def test_worker_communications_create(self):
     self.c.login(username='******', password='******')
     response = self.c.post(
         '/worker_profile/worker_profile/worker_communications/',
         data={
             "worker_profile": 1,
             "social_network": WorkerCommunications.Type.facebook_id,
             "social_networks_ids": "@asdsa"
         },
         format='json')
     dump.dump(response)
     self.assertEqual(response.status_code, status.HTTP_201_CREATED)
Esempio n. 8
0
    def test_worker_profile_create(self):
        self.c.login(username='******', password='******')
        response = self.c.post('/worker_profile/worker_profile/',
                               data={
                                   'first_name': 'testtest',
                                   'second_name': 'testtesttest',
                                   'position': 'admin',
                                   'phone_number': '+222222222222',
                                   'email': '*****@*****.**',
                                   'worker': self.user.id,
                               },
                               format='json')

        dump.dump(response)
        self.assertEqual(response.status_code, status.HTTP_201_CREATED)
Esempio n. 9
0
    def test_worker_profile_list(self):
        response = self.c.get('/worker_profile/worker_profile/')

        self.assertEqual(response.status_code, status.HTTP_200_OK)
        dump.dump(response)
        self.assertEqual(
            response.data, {
                "count":
                1,
                "next":
                None,
                "previous":
                None,
                "results": [{
                    "id": self.worker.id,
                    "first_name": self.worker.first_name,
                    "second_name": self.worker.second_name,
                    "position": self.worker.position,
                    "phone_number": self.worker.phone_number,
                    "email": self.worker.email,
                    "worker": self.worker.worker
                }]
            })