def test_also_gets_invoices_where_im_a_consumer(self):
     url = reverse('invoice-list')
     headers = get_proxy_headers(self.user_2.id)
     response = self.client.get(url, **headers)
     num_invoices = response.json().get('count')
     assert num_invoices == 4, \
         'Expected 4. got: {}'.format(num_invoices)
 def test_only_practitioner_can_access(self):
     user = create_mock_user('joe')
     invoice = create_mock_invoice()
     url = reverse('invoice-appointments', args=(invoice.pk, ))
     headers = get_proxy_headers(user.id)
     response = self.client.post(url,
                                 json.dumps({}),
                                 content_type='application/json',
                                 **headers)
     assert response.status_code == 404
    def setUp(self):

        responses.add(responses.GET,
                      'http://appointmentguru/api/practitioners/1/',
                      json={'id': '1'},
                      status=200)

        responses.add(responses.GET,
                      'http://appointmentguru/api/appointments/2/',
                      json={
                          'id': '2',
                          'price': '10',
                          'full_name': 'Joe Soap',
                          'start_time': '2017-10-02T16:00:00Z'
                      },
                      status=200)

        responses.add(responses.GET,
                      'http://appointmentguru/api/appointments/3/',
                      json={
                          'id': '3',
                          'price': '5',
                          'start_time': '2017-10-02T16:00:00Z'
                      },
                      status=200)

        responses.add(responses.GET,
                      'http://medicalaidguru/records/4',
                      json={'id': '4'},
                      status=404)

        url = reverse('invoice-construct')
        qs = 'practitioner_id=1&appointment_ids=2,3&client_id=4'
        url = '{}?{}'.format(url, qs)
        headers = get_proxy_headers(1)
        data = {
            'context': {
                'title': 'This is a test',
                'invoice_period_from': '2017-09-01',
                'invoice_period_to': '2017-09-30',
                'date': '2017-09-25',
                'due_date': '2017-09-25',
            }
        }
        self.response = self.client.post(url,
                                         json.dumps(data),
                                         content_type='application/json',
                                         **headers)
    def setUp(self):
        user_1 = create_mock_user('joe')
        user_2 = create_mock_user('jane')

        create_mock_invoice(user_1.id)
        create_mock_invoice(user_1.id)
        create_mock_invoice(user_1.id, user_2.id)

        create_mock_invoice(user_2.id)
        create_mock_invoice(user_2.id)
        create_mock_invoice(user_2.id)

        self.user_2 = user_2

        self.url = reverse('invoice-list')
        headers = get_proxy_headers(user_1.id)
        self.response = self.client.get(self.url, **headers)
    def setUp(self):
        responses.add(responses.GET,
                      'http://appointmentguru/api/appointments/1/',
                      json={'id': '1'},
                      status=200)
        responses.add(responses.GET,
                      'http://appointmentguru/api/appointments/2/',
                      json={'id': '2'},
                      status=200)
        responses.add(responses.GET,
                      'http://appointmentguru/api/appointments/3/',
                      json={'id': '3'},
                      status=200)

        invoice = create_mock_invoice()
        self.url = reverse('invoice-appointments', args=(invoice.pk, ))
        headers = get_proxy_headers(invoice.practitioner_id)
        data = {'appointments': '1,2,3'}
        self.response = self.client.post(self.url,
                                         json.dumps(data),
                                         content_type='application/json',
                                         **headers)
示例#6
0
 def setUp(self):
     invoice = create_mock_invoice(1, 1)
     url = reverse('invoice-send', args=(invoice.id, ))
     data = {"to_email": "*****@*****.**"}
     self.response = self.client.post(url, **get_proxy_headers(1))
     self.invoice = invoice