Total Complexity | 25 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | # -*- coding: utf-8 -*- |
||
8 | class ContractTestSuite(unittest.TestCase): |
||
9 | """Contact Integration test cases.""" |
||
10 | |||
11 | @staticmethod |
||
12 | def test_balance_json(): |
||
13 | flightradar24.Api() |
||
14 | |||
15 | @staticmethod |
||
16 | def test_airports(): |
||
17 | fr = flightradar24.Api() |
||
18 | airports = fr.get_airports() |
||
19 | assert airports['rows'] is not None |
||
20 | assert len(airports['rows']) > 100 # Expect more than 100 airports |
||
21 | check_jfk = 0 |
||
22 | for airport in airports['rows']: |
||
23 | if airport['iata'] == "JFK": |
||
24 | check_jfk = 1 |
||
25 | assert check_jfk == 1 |
||
26 | |||
27 | @staticmethod |
||
28 | def test_airlines(): |
||
29 | fr = flightradar24.Api() |
||
30 | airlines = fr.get_airlines() |
||
31 | assert airlines['rows'] is not None |
||
32 | assert len(airlines['rows']) > 100 # Expect more than 100 airports |
||
33 | check_tk = 0 |
||
34 | for airline in airlines['rows']: |
||
35 | if airline['ICAO'] == "THY": |
||
36 | check_tk = 1 |
||
37 | assert check_tk == 1 |
||
38 | |||
39 | |||
40 | @staticmethod |
||
41 | def test_flights(): |
||
42 | fr = flightradar24.Api() |
||
43 | flights = fr.get_flights('THY') |
||
44 | assert flights['full_count'] is not None |
||
45 | assert flights['full_count'] > 100 # Expect more than 100 airports |
||
46 | |||
47 | |||
48 | @staticmethod |
||
49 | def test_flight(): |
||
50 | flight_id = 'TK1' |
||
51 | fr = flightradar24.Api() |
||
52 | flight = fr.get_flight(flight_id) |
||
53 | assert flight['result']['response']['data'] is not None |
||
54 | assert len(flight['result']['response']['data']) > 1 # Expect more than 100 airports |
||
55 | assert flight['result']['response']['data'][0]['identification']['number']['default'] == flight_id |
||
56 | |||
57 | |||
58 | @staticmethod |
||
59 | def test_zones(): |
||
60 | fr = flightradar24.Api() |
||
61 | zones = fr.get_zones() |
||
62 | assert zones['europe'] is not None |
||
63 | check_uk = 0 |
||
64 | for subzone_name, subzone_details in zones['europe']['subzones'].items(): |
||
65 | if subzone_name == 'uk': |
||
66 | check_uk = 1 |
||
67 | assert check_uk == 1 |
||
68 | |||
72 |