Exemplo n.º 1
0
    def test_empty_list(self):
        # pusta lista
        response = self.client.get(self.url)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(response.data), 0)

        # transakcje innego uzytkownika
        patient = PatientFactory.create()
        TransactionFactory.create_batch(20, patient=patient)

        response = self.client.get(self.url)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(response.data), 0)
Exemplo n.º 2
0
    def test_invalid_transaction_patient(self):
        # Sprawdzamy transakcje nalezaca do innego pacjenta
        patient = PatientFactory.create()
        transaction = TransactionFactory.create(patient=patient)

        response = self.client.get(self.url.format(transaction.id))
        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
Exemplo n.º 3
0
    def test_get_transaction_doctor(self):
        self.assertTrue(self.client.force_login(self.doctor))
        patient = PatientFactory(doctor=self.doctor)
        transaction = TransactionFactory.create(patient=patient)

        response = self.client.get(self.url.format(transaction.id))
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(response.data), 8)
Exemplo n.º 4
0
    def setUp(self):
        self.patient = PatientFactory.create()
        self.transaction = TransactionFactory.create(patient=self.patient)
        self.url = '/paymentprovider/orderstatus'

        self.ORDER_STATUS_COMPLETED = {
            "order": {
                "orderId": "LDLW5N7MF4140324GUEST000P01",
                "extOrderId": self.transaction.payment_id,
                "orderCreateDate": "2012-12-31T12:00:00",
                "notifyUrl": "http://tempuri.org/notify",
                "customerIp": "127.0.0.1",
                "merchantPosId": "{POS ID (pos_id)}",
                "description": "My order description",
                "currencyCode": "PLN",
                "totalAmount": "200",
                "buyer": {
                    "email": "*****@*****.**",
                    "phone": "111111111",
                    "firstName": "John",
                    "lastName": "Doe"
                },
                "products": {
                    "name": "Product 1",
                    "unitPrice": "200",
                    "quantity": "1"
                },
                "status": "COMPLETED"
            }
        }

        self.ORDER_STATUS_CANCELED = {
            "order": {
                "orderId": "LDLW5N7MF4140324GUEST000P01",
                "extOrderId": self.transaction.payment_id,
                "orderCreateDate": "2012-12-31T12:00:00",
                "notifyUrl": "http://tempuri.org/notify",
                "customerIp": "127.0.0.1",
                "merchantPosId": "{POS ID (pos_id)}",
                "description": "My order description",
                "currencyCode": "PLN",
                "totalAmount": "200",
                "products": {
                    "name": "Product 1",
                    "unitPrice": "200",
                    "quantity": "1"
                },
                "status": "CANCELED"
            }
        }

        self.ORDER_STATUS_PENDING = {
            "order": {
                "extOrderId": self.transaction.payment_id,
                "status": "PENDING"
            }
        }
Exemplo n.º 5
0
    def test_invalid_transaction_doctor(self):
        # Brak mozliwosci sprawdzenia transakcji pacjenta innego doktora
        self.assertTrue(self.client.force_login(self.doctor))
        doctor = DoctorFactory.create()
        patient = PatientFactory(doctor=doctor)
        transaction = TransactionFactory.create(patient=patient)

        response = self.client.get(self.url.format(transaction.id))
        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
Exemplo n.º 6
0
    def test_get_transaction_patient(self):
        transaction = TransactionFactory.create(patient=self.patient)

        response = self.client.get(self.url.format(transaction.id))
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(response.data), 7)
Exemplo n.º 7
0
    def test_invalid_transaction_id(self):
        transaction = TransactionFactory.create()
        transaction.delete()

        response = self.client.get(self.url.format(transaction.id))
        self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
Exemplo n.º 8
0
    def test_non_empty_list(self):
        TransactionFactory.create_batch(20, patient=self.patient)

        response = self.client.get(self.url)
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.assertEqual(len(response.data), 20)