Skip to content

Commit 7a61c21

Browse files
committed
update tests
1 parent 1e52f41 commit 7a61c21

File tree

3 files changed

+17
-43
lines changed

3 files changed

+17
-43
lines changed

amadeus/travel/_encoder.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,5 @@ def from_base64(base64):
1515
# Takes a Base64 and returns a dict
1616
def __build_trip_parser_body(base64):
1717
return {
18-
'data': {
19-
'type': 'trip-parser-job',
20-
'content': base64,
21-
},
18+
'payload': base64,
2219
}

specs/mixins/encoder_spec.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,14 @@
1717
+ '/encoder_specs_file.eml'
1818
base64 = 'Ym9va2luZw=='
1919
body = {
20-
'data': {
21-
'type': 'trip-parser-job',
22-
'content': base64,
23-
},
20+
'payload': base64,
2421
}
2522
expect(from_file(file)).to(equal(body))
2623

2724
with description('Travel/From Base64'):
2825
with it('should generate the defined POST body from base64'):
2926
base64 = 'Ym9va2luZw=='
3027
body = {
31-
'data': {
32-
'type': 'trip-parser-job',
33-
'content': base64,
34-
},
28+
'payload': base64,
3529
}
3630
expect(from_base64(base64)).to(equal(body))

specs/namespaces/namespaces_spec.py

Lines changed: 14 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@
6969
expect(client.airport.predictions.on_time).not_to(be_none)
7070
expect(client.airport.direct_destinations).not_to(be_none)
7171

72-
expect(client.travel.trip_parser_jobs).not_to(be_none)
73-
expect(client.travel.trip_parser_jobs.status).not_to(be_none)
74-
expect(client.travel.trip_parser_jobs.result).not_to(be_none)
72+
expect(client.travel.trip_parser).not_to(be_none)
7573

7674
expect(client.travel.from_file).not_to(be_none)
7775
expect(client.travel.from_base64).not_to(be_none)
@@ -146,9 +144,6 @@
146144
expect(client.airport.predictions.on_time.get).not_to(be_none)
147145
expect(client.airport.direct_destinations.get).not_to(be_none)
148146

149-
expect(client.travel.trip_parser_jobs.status('123').get).not_to(be_none)
150-
expect(client.travel.trip_parser_jobs.result('123').get).not_to(be_none)
151-
152147
expect(client.booking.flight_order('123').get).not_to(be_none)
153148
expect(client.booking.flight_order('123').delete).not_to(be_none)
154149

@@ -173,7 +168,7 @@
173168

174169
with it('should define all expected .post methods'):
175170
client = self.client
176-
expect(client.travel.trip_parser_jobs.post).not_to(be_none)
171+
expect(client.travel.trip_parser.post).not_to(be_none)
177172

178173
with context('testing all calls to the client'):
179174
with before.each:
@@ -347,45 +342,33 @@
347342
'/v1/airport/direct-destinations', a='b'
348343
))
349344

350-
with it('.travel.trip_parser_jobs.status().get'):
351-
self.client.travel.trip_parser_jobs.status('XXX').get(a='b')
352-
expect(self.client.get).to(have_been_called_with(
353-
'/v2/travel/trip-parser-jobs/XXX', a='b'
354-
))
355-
356-
with it('.travel.trip_parser_jobs.result().get'):
357-
self.client.travel.trip_parser_jobs.result('XXX').get(a='b')
358-
expect(self.client.get).to(have_been_called_with(
359-
'/v2/travel/trip-parser-jobs/XXX/result', a='b'
360-
))
361-
362345
with it('.shopping.flight_offers.prediction.post'):
363346
self.client.shopping.flight_offers.prediction.post({'foo': 'bar'})
364347
expect(self.client.post).to(have_been_called_with(
365348
'/v2/shopping/flight-offers/prediction', {'foo': 'bar'}
366349
))
367350

368-
with it('.travel.trip_parser_jobs.post'):
369-
self.client.travel.trip_parser_jobs.post({'foo': 'bar'})
351+
with it('.travel.trip_parser.post'):
352+
self.client.travel.trip_parser.post({'foo': 'bar'})
370353
expect(self.client.post).to(have_been_called_with(
371-
'/v2/travel/trip-parser-jobs', {'foo': 'bar'}
354+
'/v3/travel/trip-parser', {'foo': 'bar'}
372355
))
373356

374-
with it('.travel.trip_parser_jobs.post_from_base64'):
375-
self.client.travel.trip_parser_jobs.post(
376-
self.client.travel.from_base64('dGVzdA=='))
357+
with it('.travel.trip_parser.post_from_base64'):
358+
self.client.travel.trip_parser.post(
359+
self.client.travel.from_base64('Qm9va2luZwo='))
377360
expect(self.client.post).to(have_been_called_with(
378-
'/v2/travel/trip-parser-jobs',
379-
{'data': {'type': 'trip-parser-job', 'content': 'dGVzdA=='}}
361+
'/v3/travel/trip-parser',
362+
{'payload': 'Qm9va2luZwo='}
380363
))
381364

382-
with it('.travel.trip_parser_jobs.post_from_file'):
365+
with it('.travel.trip_parser.post_from_file'):
383366
file = 'specs/namespaces/trip_parser_test.eml'
384-
self.client.travel.trip_parser_jobs.post(
367+
self.client.travel.trip_parser.post(
385368
self.client.travel.from_file(file))
386369
expect(self.client.post).to(have_been_called_with(
387-
'/v2/travel/trip-parser-jobs',
388-
{'data': {'type': 'trip-parser-job', 'content': 'Qm9va2luZwo='}}
370+
'/v3/travel/trip-parser',
371+
{'payload': 'Qm9va2luZwo='}
389372
))
390373

391374
with it('.shopping.flight_offers_search.post'):

0 commit comments

Comments
 (0)