Exemplo n.º 1
0
    def test_doctor_same_hospital_get_admin_info(self):
        response = self.client.post(
            "/doctors", {
                "email": "*****@*****.**",
                "password": "******",
                "first_name": "Vasco",
                "last_name": "Ramos",
                "birth_date": "2020-03-04"
            })
        self.assertEqual(response.status_code, HTTP_201_CREATED)

        login(self.client, "*****@*****.**", "pwd")

        response = self.client.get("/admins/[email protected]")
        self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)
Exemplo n.º 2
0
 def setUp(self):
     response = self.client.post(
         "/clients", {
             "email": "*****@*****.**",
             "password": "******",
             "first_name": "Vasco",
             "last_name": "Ramos",
             "height": 1.60,
             "weight_goal": 65,
             "current_weight": 90,
             "sex": "Male",
             "birth_date": "2020-03-04"
         })
     self.assertEqual(response.status_code, HTTP_201_CREATED)
     login(self.client, "*****@*****.**", "pwd")
Exemplo n.º 3
0
 def test_get_client_info_other_client(self):
     response = self.client.post(
         "/clients", {
             "email": "*****@*****.**",
             "password": "******",
             "first_name": "Tomas",
             "last_name": "Ramos",
             "height": 1.60,
             "weight_goal": 65,
             "current_weight": 90,
             "sex": "Male",
             "birth_date": "2020-03-04"
         })
     self.assertEqual(response.status_code, HTTP_201_CREATED)
     login(self.client, "*****@*****.**", "pwd")
     response = self.client.get("/clients/[email protected]")
     self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)
Exemplo n.º 4
0
 def test_get_client_info_client_doctor(self):
     Client.objects.filter(user__auth_user__username="******").update(
         doctor=self.doctor)
     login(self.client, "*****@*****.**", "pwd")
     response = self.client.get("/clients/[email protected]")
     self.assertEqual(response.status_code, HTTP_200_OK)
Exemplo n.º 5
0
 def test_get_client_self_info(self):
     login(self.client, "*****@*****.**", "pwd")
     response = self.client.get("/clients/[email protected]")
     self.assertEqual(response.status_code, HTTP_200_OK)
Exemplo n.º 6
0
 def test_get_client_info_client_no_doctor(self):
     login(self.client, "*****@*****.**", "pwd")
     response = self.client.get("/clients/[email protected]")
     self.assertEqual(response.status_code, HTTP_403_FORBIDDEN)