|
1 | 1 | #!/usr/bin/env python |
2 | 2 |
|
3 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | -# you may not use this file except in compliance with the License. |
| 4 | +# You may not use this file except in compliance with the License. |
5 | 5 | # You may obtain a copy of the License at |
6 | 6 | # |
7 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
|
19 | 19 | from test.unit.helper.test_helper import appium_command, get_httpretty_request_body, ios_w3c_driver |
20 | 20 |
|
21 | 21 |
|
22 | | -class TestWebDriverLog(object): |
23 | | - @httpretty.activate |
24 | | - def test_get_log_types(self): |
25 | | - driver = ios_w3c_driver() |
26 | | - httpretty.register_uri( |
27 | | - httpretty.GET, |
28 | | - appium_command('/session/1234567890/log/types'), |
29 | | - body=json.dumps({'value': ['syslog']}), |
30 | | - ) |
31 | | - log_types = driver.log_types |
32 | | - assert log_types == ['syslog'] |
33 | | - |
34 | | - @httpretty.activate |
35 | | - def test_get_log(self): |
36 | | - driver = ios_w3c_driver() |
37 | | - httpretty.register_uri( |
38 | | - httpretty.POST, |
39 | | - appium_command('/session/1234567890/log'), |
40 | | - body=json.dumps({'value': ['logs as array']}), |
41 | | - ) |
42 | | - log_types = driver.get_log('syslog') |
43 | | - assert log_types == ['logs as array'] |
44 | | - |
45 | | - d = get_httpretty_request_body(httpretty.last_request()) |
46 | | - assert {'type': 'syslog'} == d |
| 22 | +@httpretty.activate |
| 23 | +def test_get_log_types(): |
| 24 | + driver = ios_w3c_driver() |
| 25 | + httpretty.register_uri( |
| 26 | + httpretty.GET, |
| 27 | + appium_command('/session/1234567890/log/types'), |
| 28 | + body=json.dumps({'value': ['syslog']}), |
| 29 | + ) |
| 30 | + log_types = driver.log_types |
| 31 | + assert log_types == ['syslog'] |
| 32 | + |
| 33 | + |
| 34 | +@httpretty.activate |
| 35 | +def test_get_log(): |
| 36 | + driver = ios_w3c_driver() |
| 37 | + httpretty.register_uri( |
| 38 | + httpretty.POST, |
| 39 | + appium_command('/session/1234567890/log'), |
| 40 | + body=json.dumps({'value': ['logs as array']}), |
| 41 | + ) |
| 42 | + log_types = driver.get_log('syslog') |
| 43 | + assert log_types == ['logs as array'] |
| 44 | + |
| 45 | + d = get_httpretty_request_body(httpretty.last_request()) |
| 46 | + assert {'type': 'syslog'} == d |
0 commit comments