Skip to content
Open
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
24 changes: 20 additions & 4 deletions test/unit/webdriver/device/lock_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ def test_islocked_true(self):
assert driver.is_locked() is True

@httpretty.activate
def test_unlock(self):
def test_unlock_when_locked(self):
driver = android_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/execute/sync'), body='{"value": true}')
assert isinstance(driver.unlock(), WebDriver)
assert get_httpretty_request_body(httpretty.last_request())['script'] == 'mobile: unlock'
assert get_httpretty_request_body(httpretty.latest_requests()[-4])['script'] == 'mobile: isLocked'
assert get_httpretty_request_body(httpretty.latest_requests()[-2])['script'] == 'mobile: unlock'

@httpretty.activate
def test_unlock_when_unlocked(self):
driver = android_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/execute/sync'), body='{"value": false}')
assert isinstance(driver.unlock(), WebDriver)
assert get_httpretty_request_body(httpretty.latest_requests()[-2])['script'] == 'mobile: isLocked'


class TestWebDriverLockIOS:
Expand Down Expand Up @@ -85,11 +93,19 @@ def test_islocked_true(self):
assert driver.is_locked() is True

@httpretty.activate
def test_unlock(self):
def test_unlock_when_locked(self):
driver = ios_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/execute/sync'), body='{"value": true}')
assert isinstance(driver.unlock(), WebDriver)
assert get_httpretty_request_body(httpretty.last_request())['script'] == 'mobile: unlock'
assert get_httpretty_request_body(httpretty.latest_requests()[-4])['script'] == 'mobile: isLocked'
assert get_httpretty_request_body(httpretty.latest_requests()[-2])['script'] == 'mobile: unlock'

@httpretty.activate
def test_unlock_when_unlocked(self):
driver = ios_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/execute/sync'), body='{"value": false}')
assert isinstance(driver.unlock(), WebDriver)
assert get_httpretty_request_body(httpretty.latest_requests()[-2])['script'] == 'mobile: isLocked'

@httpretty.activate
def test_touch_id(self):
Expand Down
Loading