|
22 | 22 | client.add_header('Origin', 'http://localhost') |
23 | 23 | client.set_self_signed() |
24 | 24 |
|
25 | | -def print_result(response): |
26 | | - if isinstance(response, dict): |
27 | | - print(response['result']) |
28 | | - return |
29 | | - |
30 | | - print(response.result) |
31 | | - |
32 | 25 | print("\nTest Started") |
33 | 26 |
|
34 | 27 | # Foo Tests |
35 | 28 |
|
36 | 29 | response = foo.get('string', 123, ['string in array']) |
37 | | -print_result(response) |
| 30 | +print(response.result) |
38 | 31 |
|
39 | 32 | response = foo.post('string', 123, ['string in array']) |
40 | | -print_result(response) |
| 33 | +print(response.result) |
41 | 34 |
|
42 | 35 | response = foo.put('string', 123, ['string in array']) |
43 | | -print_result(response) |
| 36 | +print(response.result) |
44 | 37 |
|
45 | 38 | response = foo.patch('string', 123, ['string in array']) |
46 | | -print_result(response) |
| 39 | +print(response.result) |
47 | 40 |
|
48 | 41 | response = foo.delete('string', 123, ['string in array']) |
49 | | -print_result(response) |
| 42 | +print(response.result) |
50 | 43 |
|
51 | 44 | # Bar Tests |
52 | 45 |
|
53 | 46 | response = bar.get('string',123, ['string in array']) |
54 | | -print_result(response) |
| 47 | +print(response.result) |
55 | 48 |
|
56 | 49 | response = bar.post('string', 123, ['string in array']) |
57 | | -print_result(response) |
| 50 | +print(response.result) |
58 | 51 |
|
59 | 52 | response = bar.put('string', 123, ['string in array']) |
60 | | -print_result(response) |
| 53 | +print(response.result) |
61 | 54 |
|
62 | 55 | response = bar.patch('string', 123, ['string in array']) |
63 | | -print_result(response) |
| 56 | +print(response.result) |
64 | 57 |
|
65 | 58 | response = bar.delete('string', 123, ['string in array']) |
66 | | -print_result(response) |
| 59 | +print(response.result) |
67 | 60 |
|
68 | 61 | # General Tests |
69 | 62 |
|
70 | 63 | response = general.redirect() |
71 | | -print_result(response) |
| 64 | +print(response['result']) |
72 | 65 |
|
73 | 66 | response = general.upload('string', 123, ['string in array'], InputFile.from_path('./tests/resources/file.png')) |
74 | | -print_result(response) |
| 67 | +print(response.result) |
75 | 68 |
|
76 | 69 | response = general.upload('string', 123, ['string in array'], InputFile.from_path('./tests/resources/large_file.mp4')) |
77 | | -print_result(response) |
| 70 | +print(response.result) |
78 | 71 |
|
79 | 72 | data = open('./tests/resources/file.png', 'rb').read() |
80 | 73 | response = general.upload('string', 123, ['string in array'], InputFile.from_bytes(data, 'file.png', 'image/png')) |
81 | | -print_result(response) |
| 74 | +print(response.result) |
82 | 75 |
|
83 | 76 | data = open('./tests/resources/large_file.mp4', 'rb').read() |
84 | 77 | response = general.upload('string', 123, ['string in array'], InputFile.from_bytes(data, 'large_file.mp4','video/mp4')) |
85 | | -print_result(response) |
| 78 | +print(response.result) |
86 | 79 |
|
87 | 80 | response = general.enum(MockType.FIRST) |
88 | | -print_result(response) |
| 81 | +print(response.result) |
89 | 82 |
|
90 | 83 | # Request model tests |
91 | 84 | response = general.create_player(Player(id='player1', name='John Doe', score=100)) |
92 | | -print_result(response) |
| 85 | +print(response.result) |
93 | 86 |
|
94 | 87 | response = general.create_players([ |
95 | 88 | {'id': 'player1', 'name': 'John Doe', 'score': 100}, |
96 | 89 | {'id': 'player2', 'name': 'Jane Doe', 'score': 200} |
97 | 90 | ]) |
98 | | -print_result(response) |
| 91 | +print(response.result) |
99 | 92 |
|
100 | 93 | try: |
101 | 94 | response = general.error400() |
@@ -255,4 +248,4 @@ def print_result(response): |
255 | 248 | print(Operator.date_set_now()) |
256 | 249 |
|
257 | 250 | response = general.headers() |
258 | | -print_result(response) |
| 251 | +print(response.result) |
0 commit comments