Esempio n. 1
0
    def test_list(self):
        """ Verify the endpoint returns a list of all CreditProvider objects. """
        response = self.client.get(self.path)
        assert response.status_code == 200

        expected = CreditProviderSerializer(CreditProvider.objects.all(), many=True).data
        assert response.data == expected
Esempio n. 2
0
 def test_retrieve(self):
     """ Verify the endpoint returns the details for a single CreditProvider. """
     url = reverse('credit:creditprovider-detail',
                   kwargs={'provider_id': self.bayside.provider_id})
     response = self.client.get(url)
     assert response.status_code == 200
     assert response.data == CreditProviderSerializer(self.bayside).data
Esempio n. 3
0
    def test_list_filtering(self, provider_ids):
        """ Verify the endpoint returns a list of all CreditProvider objects, filtered to contain only those objects
        associated with the given IDs. """
        url = '{}?provider_ids={}'.format(self.path, ','.join(provider_ids))
        response = self.client.get(url)
        assert response.status_code == 200

        expected = CreditProviderSerializer(CreditProvider.objects.filter(provider_id__in=provider_ids),
                                            many=True).data
        assert response.data == expected