Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Move log_test.py to pytest style #1094

Merged
merged 1 commit into from
Feb 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions test/unit/webdriver/log_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
Expand All @@ -19,28 +19,28 @@
from test.unit.helper.test_helper import appium_command, get_httpretty_request_body, ios_w3c_driver


class TestWebDriverLog(object):
@httpretty.activate
def test_get_log_types(self):
driver = ios_w3c_driver()
httpretty.register_uri(
httpretty.GET,
appium_command('/session/1234567890/log/types'),
body=json.dumps({'value': ['syslog']}),
)
log_types = driver.log_types
assert log_types == ['syslog']

@httpretty.activate
def test_get_log(self):
driver = ios_w3c_driver()
httpretty.register_uri(
httpretty.POST,
appium_command('/session/1234567890/log'),
body=json.dumps({'value': ['logs as array']}),
)
log_types = driver.get_log('syslog')
assert log_types == ['logs as array']

d = get_httpretty_request_body(httpretty.last_request())
assert {'type': 'syslog'} == d
@httpretty.activate
def test_get_log_types():
driver = ios_w3c_driver()
httpretty.register_uri(
httpretty.GET,
appium_command('/session/1234567890/log/types'),
body=json.dumps({'value': ['syslog']}),
)
log_types = driver.log_types
assert log_types == ['syslog']


@httpretty.activate
def test_get_log():
driver = ios_w3c_driver()
httpretty.register_uri(
httpretty.POST,
appium_command('/session/1234567890/log'),
body=json.dumps({'value': ['logs as array']}),
)
log_types = driver.get_log('syslog')
assert log_types == ['logs as array']

d = get_httpretty_request_body(httpretty.last_request())
assert {'type': 'syslog'} == d