Skip to content

Commit 290eb6f

Browse files
authored
Merge pull request #79 from amadeus4dev/update-tests-createorders-pricing-hotelbooking
Update tests and remove unused code from Flight Offers Pricing
2 parents c3c38cd + d1d4c6b commit 290eb6f

File tree

3 files changed

+51
-6
lines changed

3 files changed

+51
-6
lines changed

amadeus/shopping/flight_offers/_pricing.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ def post(self, body, **params):
1717
:rtype: amadeus.Response
1818
:raises amadeus.ResponseError: if the request could not be completed
1919
'''
20-
url = '/v1/shopping/flight-offers/pricing'
20+
url = '/v1/shopping/flight-offers/pricing?'
2121
flight_offers = []
22-
23-
if params is not None:
24-
url = '/v1/shopping/flight-offers/pricing?'
2522
if type(body) is not list:
2623
flight_offers.append(body)
2724
else:
2825
flight_offers.extend(body)
29-
3026
return self.client.post(url + urlencode(params),
3127
{'data':
3228
{'type': 'flight-offers-pricing',

specs/namespaces/namespaces_spec.py

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,23 @@
284284
'/v2/travel/trip-parser-jobs', {'foo': 'bar'}
285285
))
286286

287+
with it('.travel.trip_parser_jobs.post_from_base64'):
288+
self.client.travel.trip_parser_jobs.post(
289+
self.client.travel.from_base64('dGVzdA=='))
290+
expect(self.client.post).to(have_been_called_with(
291+
'/v2/travel/trip-parser-jobs',
292+
{'data': {'type': 'trip-parser-job', 'content': 'dGVzdA=='}}
293+
))
294+
295+
with it('.travel.trip_parser_jobs.post_from_file'):
296+
file = 'specs/namespaces/trip_parser_test.eml'
297+
self.client.travel.trip_parser_jobs.post(
298+
self.client.travel.from_file(file))
299+
expect(self.client.post).to(have_been_called_with(
300+
'/v2/travel/trip-parser-jobs',
301+
{'data': {'type': 'trip-parser-job', 'content': 'Qm9va2luZwo='}}
302+
))
303+
287304
with it('.shopping.flight_offers_search.post'):
288305
self.client.shopping.flight_offers_search.post({'foo': 'bar'})
289306
expect(self.client.post).to(have_been_called_with(
@@ -297,7 +314,16 @@
297314
))
298315

299316
with it('.shopping.flight_offers.pricing.post'):
300-
self.client.shopping.flight_offers.pricing.post({'foo': 'bar'})
317+
self.client.shopping.flight_offers.pricing.post(
318+
{'foo': 'bar'}, include='other-services')
319+
expect(self.client.post).to(have_been_called_with(
320+
'/v1/shopping/flight-offers/pricing?'+'include=other-services',
321+
{'data': {'type': 'flight-offers-pricing',
322+
'flightOffers': [{'foo': 'bar'}]}}
323+
))
324+
325+
with it('.shopping.flight_offers.pricing.post_list'):
326+
self.client.shopping.flight_offers.pricing.post([{'foo': 'bar'}])
301327
expect(self.client.post).to(have_been_called_with(
302328
'/v1/shopping/flight-offers/pricing?',
303329
{'data': {'type': 'flight-offers-pricing',
@@ -314,6 +340,17 @@
314340
}}
315341
))
316342

343+
with it('.shopping.booking.flight_orders.post_list'):
344+
self.client.booking.flight_orders.post(
345+
[{'foo': 'bar'}], [{'bar': 'foo'}])
346+
expect(self.client.post).to(have_been_called_with(
347+
'/v1/booking/flight-orders',
348+
{'data': {'type': 'flight-order',
349+
'flightOffers': [{'foo': 'bar'}],
350+
'travelers': [{'bar': 'foo'}]
351+
}}
352+
))
353+
317354
with it('.booking.flight_order().get'):
318355
self.client.booking.flight_order('123').get(a='b')
319356
expect(self.client.get).to(have_been_called_with(
@@ -331,3 +368,14 @@
331368
'payments': [{'bar': 'foo'}]
332369
}}
333370
))
371+
with it('.shopping.booking.hotel_bookings.post_list'):
372+
self.client.booking.hotel_bookings.post('123',
373+
[{'foo': 'bar'}],
374+
[{'bar': 'foo'}])
375+
expect(self.client.post).to(have_been_called_with(
376+
'/v1/booking/hotel-bookings',
377+
{'data': {'offerId': '123',
378+
'guests': [{'foo': 'bar'}],
379+
'payments': [{'bar': 'foo'}]
380+
}}
381+
))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Booking

0 commit comments

Comments
 (0)