Exemplo n.º 1
0
 def test_200(self):
     """ Test for gettin offers list """
     res = self.client.get('/api/organizations/{}/offers/'.format(
         self.offer.organization.id))
     self.assertEqual(res.status_code, 200)
     for offer in res.data:
         common.test_offer_list_fields(self, offer)
Exemplo n.º 2
0
 def test_organization_offer_read_status(self):
     """Test organization offer's read status for user with organization."""
     for offer in OfferFactory.create_batch(94,
                                            organization=self.organization):
         response = self.client.get('/api/offers/{id}/'.format(id=offer.id))
         self.assertEqual(response.status_code, status.HTTP_200_OK)
         common.test_offer_list_fields(self, response.data)
Exemplo n.º 3
0
    def test_offer_read_status(self):
        """Test offer's read status for admin user.

        All existing offers are visible for admin user.
        """
        for offer in OfferFactory.create_batch(63):
            response = self.client.get('/api/offers/{id}/'.format(id=offer.id))
            self.assertEqual(response.status_code, status.HTTP_200_OK)
            common.test_offer_list_fields(self, response.data)
Exemplo n.º 4
0
    def test_offer_list_fields(self):
        """Test list's fields of offers REST API endpoint."""
        OfferFactory.create_batch(42)

        response = self.client.get('/api/offers/')

        self.assertEqual(response.status_code, status.HTTP_200_OK)
        for offer in response.data:
            common.test_offer_list_fields(self, offer)
Exemplo n.º 5
0
 def _test_offer_read_fields(self, offer):
     """Test read's fields of offers REST API endpoint."""
     common.test_offer_list_fields(self, offer)
Exemplo n.º 6
0
 def test_published_offer_read_status(self):
     """Test published offer's read status for anonymous user."""
     for offer in OfferFactory.create_batch(41, offer_status='published'):
         response = self.client.get('/api/offers/{id}/'.format(id=offer.id))
         self.assertEqual(response.status_code, status.HTTP_200_OK)
         common.test_offer_list_fields(self, response.data)