Skip to content

Commit d20699f

Browse files
committed
update tests and remove unused code from prising
1 parent c3c38cd commit d20699f

File tree

3 files changed

+47
-6
lines changed

3 files changed

+47
-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: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,19 @@
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(self.client.travel.from_base64('dGVzdA=='))
289+
expect(self.client.post).to(have_been_called_with(
290+
'/v2/travel/trip-parser-jobs', {'data': {'type': 'trip-parser-job', 'content': 'dGVzdA=='}}
291+
))
292+
293+
with it('.travel.trip_parser_jobs.post_from_file'):
294+
file = 'specs/namespaces/trip_parser_test.eml'
295+
self.client.travel.trip_parser_jobs.post(self.client.travel.from_file(file))
296+
expect(self.client.post).to(have_been_called_with(
297+
'/v2/travel/trip-parser-jobs', {'data': {'type': 'trip-parser-job', 'content': 'Qm9va2luZwo='}}
298+
))
299+
287300
with it('.shopping.flight_offers_search.post'):
288301
self.client.shopping.flight_offers_search.post({'foo': 'bar'})
289302
expect(self.client.post).to(have_been_called_with(
@@ -297,7 +310,16 @@
297310
))
298311

299312
with it('.shopping.flight_offers.pricing.post'):
300-
self.client.shopping.flight_offers.pricing.post({'foo': 'bar'})
313+
self.client.shopping.flight_offers.pricing.post(
314+
{'foo': 'bar'}, include='other-services')
315+
expect(self.client.post).to(have_been_called_with(
316+
'/v1/shopping/flight-offers/pricing?'+'include=other-services',
317+
{'data': {'type': 'flight-offers-pricing',
318+
'flightOffers': [{'foo': 'bar'}]}}
319+
))
320+
321+
with it('.shopping.flight_offers.pricing.post_list'):
322+
self.client.shopping.flight_offers.pricing.post([{'foo': 'bar'}])
301323
expect(self.client.post).to(have_been_called_with(
302324
'/v1/shopping/flight-offers/pricing?',
303325
{'data': {'type': 'flight-offers-pricing',
@@ -314,6 +336,17 @@
314336
}}
315337
))
316338

339+
with it('.shopping.booking.flight_orders.post_list'):
340+
self.client.booking.flight_orders.post(
341+
[{'foo': 'bar'}], [{'bar': 'foo'}])
342+
expect(self.client.post).to(have_been_called_with(
343+
'/v1/booking/flight-orders',
344+
{'data': {'type': 'flight-order',
345+
'flightOffers': [{'foo': 'bar'}],
346+
'travelers': [{'bar': 'foo'}]
347+
}}
348+
))
349+
317350
with it('.booking.flight_order().get'):
318351
self.client.booking.flight_order('123').get(a='b')
319352
expect(self.client.get).to(have_been_called_with(
@@ -331,3 +364,14 @@
331364
'payments': [{'bar': 'foo'}]
332365
}}
333366
))
367+
with it('.shopping.booking.hotel_bookings.post_list'):
368+
self.client.booking.hotel_bookings.post('123',
369+
[{'foo': 'bar'}],
370+
[{'bar': 'foo'}])
371+
expect(self.client.post).to(have_been_called_with(
372+
'/v1/booking/hotel-bookings',
373+
{'data': {'offerId': '123',
374+
'guests': [{'foo': 'bar'}],
375+
'payments': [{'bar': 'foo'}]
376+
}}
377+
))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Booking

0 commit comments

Comments
 (0)