Skip to content

Commit

Permalink
Merge pull request #73 from gadventures/fix-unlistable-test-case
Browse files Browse the repository at this point in the history
Swap Activity for Accommodation in non-listable test case...
  • Loading branch information
marz619 committed Sep 25, 2017
2 parents 29f4217 + 7bcec8a commit 88fa4f6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from gapipy.client import Client
from gapipy.query import Query
from gapipy.resources import Accommodation, Departure, Tour, TourDossier
from gapipy.resources import Activity, Departure, Tour, TourDossier
from gapipy.resources.base import Resource
from gapipy.utils import get_available_resource_classes

Expand Down Expand Up @@ -180,23 +180,23 @@ def test_query_reset_filter(self, mock_request):
self.assertEqual(query._filters, {})

def test_listing_non_listable_resource_fails(self):
message = 'The Accommodation resource is not listable and/or is only available as a subresource'
message = 'The Activity resource is not listable and/or is only available as a subresource'
if sys.version_info.major < 3:
with self.assertRaisesRegexp(ValueError, message):
Query(self.client, Accommodation).all()
Query(self.client, Activity).all()
with self.assertRaisesRegexp(ValueError, message):
Query(self.client, Accommodation).count()
Query(self.client, Activity).count()
else:
with self.assertRaisesRegex(ValueError, message):
Query(self.client, Accommodation).all()
Query(self.client, Activity).all()
with self.assertRaisesRegex(ValueError, message):
Query(self.client, Accommodation).count()
Query(self.client, Activity).count()

@patch('gapipy.request.APIRequestor._request', return_value=DUMMY_PROMOTION)
def test_can_retrieve_single_non_listable_resource(self, mock_request):
Query(self.client, Accommodation).get(1234)
Query(self.client, Activity).get(1234)
mock_request.assert_called_once_with(
'/accommodations/1234', 'GET')
'/activities/1234', 'GET')

@patch('gapipy.request.APIRequestor._request', return_value=DUMMY_DEPARTURE)
def test_can_retrieve_single_subresource_without_parent(self, mock_request):
Expand Down

0 comments on commit 88fa4f6

Please sign in to comment.