Loading...
Searching...
No Matches
lomiri.shell.tests.test_lock_screen.TestLockscreen Class Reference
Inheritance diagram for lomiri.shell.tests.test_lock_screen.TestLockscreen:
[legend]
Collaboration diagram for lomiri.shell.tests.test_lock_screen.TestLockscreen:
[legend]

## Public Member Functions

| test_can_unlock_pin_screen (self)
| test_can_unlock_passphrase_screen (self)
| test_pin_screen_wrong_code (self)
| test_passphrase_screen_wrong_password (self)
Public Member Functions inherited from lomiri.shell.tests.LomiriTestCase
| setUpClass (cls)
| setUp (self)
| launch_lomiri (self, mode="full-greeter", *args)
| patch_lightdm_mock (self)
| wait_for_lomiri (self)
| get_dash (self)
| main_window (self)

## Static Public Attributes

| scenarios = lomiri_scenarios.get_device_simulation_scenarios()

## Protected Member Functions

| _wait_for_lockscreen (self)
| _enter_pin_passphrase (self, passphrase)
| _enter_prompt_passphrase (self, passphrase)
Protected Member Functions inherited from lomiri.shell.tests.LomiriTestCase
| _setup_display_details (self)
| _determine_geometry (self)
| _setup_grid_size (self, scale_divisor)
| _geo_larger_than_display (self, width, height)
| _get_scaled_down_geo (self, width, height)
| _launch_lomiri_with_upstart (self, binary_path, args)
| _patch_data_dirs (self)
| _get_lightdm_mock_path (self)
| _set_proxy (self, proxy)
| _clear_proxy (self)

## Additional Inherited Members

Public Attributes inherited from lomiri.shell.tests.LomiriTestCase
list | lomiri_geometry_args = []
int | grid_size = 8
Protected Attributes inherited from lomiri.shell.tests.LomiriTestCase
| _proxy = None
bool | _qml_mock_enabled = True
bool | _data_dirs_mock_enabled = True
dict | _environment = {}
| _clear_proxy

## Detailed Description

    Tests for the lock screen.

Definition at line 32 of file test_lock_screen.py.

## Member Function Documentation

## _enter_pin_passphrase()

lomiri.shell.tests.test_lock_screen.TestLockscreen._enter_pin_passphrase | ( |  | self,
|  |  | passphrase )

protected

    Enter the password specified in 'passphrase' into the password entry
    field of the pin lock screen.

    :param passphrase: The string you want to enter.
    :raises: TypeError if passphrase is not a string.

Definition at line 112 of file test_lock_screen.py.

def _enter_pin_passphrase(self, passphrase):
"""Enter the password specified in 'passphrase' into the password entry
field of the pin lock screen.
:param passphrase: The string you want to enter.
:raises: TypeError if passphrase is not a string.
"""
if not isinstance(passphrase, str):
raise TypeError(
"'passphrase' parameter must be a string, not %r."
% type(passphrase)
)
pin_entry_field = self.main_window.get_pinentryField()
# pinentryField should automatically have focus
self.keyboard.type(passphrase)
logger.debug("Typed passphrase: %s", pin_entry_field.text)
self.assertEqual(pin_entry_field.text, passphrase)
self.keyboard.type("\n")

## _enter_prompt_passphrase()

lomiri.shell.tests.test_lock_screen.TestLockscreen._enter_prompt_passphrase | ( |  | self,
|  |  | passphrase )

protected

    Enter the password specified in 'passphrase' into the password entry
    field of the main user list's prompt.

    :param passphrase: The string you want to enter.
    :raises: TypeError if passphrase is not a string.

Definition at line 133 of file test_lock_screen.py.

def _enter_prompt_passphrase(self, passphrase):
"""Enter the password specified in 'passphrase' into the password entry
field of the main user list's prompt.
:param passphrase: The string you want to enter.
:raises: TypeError if passphrase is not a string.
"""
if not isinstance(passphrase, str):
raise TypeError(
"'passphrase' parameter must be a string, not %r."
% type(passphrase)
)
prompt = self.main_window.get_greeter().get_prompt()
prompt.write(passphrase)
logger.debug("Typed passphrase: %s", prompt.text)
self.keyboard.type("\n")

## _wait_for_lockscreen()

lomiri.shell.tests.test_lock_screen.TestLockscreen._wait_for_lockscreen | ( |  | self | ) |

protected

    Wait for the lock screen to load, and return it.

Definition at line 104 of file test_lock_screen.py.

def _wait_for_lockscreen(self):
"""Wait for the lock screen to load, and return it."""
pinPadLoader = self.main_window.get_pinPadLoader()
self.assertThat(pinPadLoader.progress, Eventually(Equals(1)))
lockscreen = self.main_window.get_lockscreen()
self.assertThat(lockscreen.shown, Eventually(Equals(True)))
return lockscreen

## test_can_unlock_passphrase_screen()

lomiri.shell.tests.test_lock_screen.TestLockscreen.test_can_unlock_passphrase_screen | ( |  | self | ) |

    Must be able to unlock the passphrase entry screen.

Definition at line 53 of file test_lock_screen.py.

def test_can_unlock_passphrase_screen(self):
"""Must be able to unlock the passphrase entry screen."""
self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-passphrase"
self.launch_lomiri()
greeter = self.main_window.get_greeter()
if not greeter.tabletMode:
greeter.swipe()
self._wait_for_lockscreen()
self._enter_pin_passphrase("password")
else:
self._enter_prompt_passphrase("password")
self.assertThat(greeter.shown, Eventually(Equals(False)))

## test_can_unlock_pin_screen()

lomiri.shell.tests.test_lock_screen.TestLockscreen.test_can_unlock_pin_screen | ( |  | self | ) |

    Must be able to unlock the PIN entry lock screen.

Definition at line 38 of file test_lock_screen.py.

def test_can_unlock_pin_screen(self):
"""Must be able to unlock the PIN entry lock screen."""
self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-pin"
self.launch_lomiri()
greeter = self.main_window.get_greeter()
if not greeter.tabletMode:
greeter.swipe()
self._wait_for_lockscreen()
self.main_window.enter_pin_code("1234")
else:
self._enter_prompt_passphrase("1234\n")
self.assertThat(greeter.shown, Eventually(Equals(False)))

## test_passphrase_screen_wrong_password()

lomiri.shell.tests.test_lock_screen.TestLockscreen.test_passphrase_screen_wrong_password | ( |  | self | ) |

    Entering the wrong password must not dismiss the lock screen.

Definition at line 86 of file test_lock_screen.py.

def test_passphrase_screen_wrong_password(self):
"""Entering the wrong password must not dismiss the lock screen."""
self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-passphrase"
self.launch_lomiri()
greeter = self.main_window.get_greeter()
if not greeter.tabletMode:
greeter.swipe()
self._wait_for_lockscreen()
self._enter_pin_passphrase("foobar")
pinentryField = self.main_window.get_pinentryField()
self.assertThat(pinentryField.text, Eventually(Equals("")))
else:
self._enter_prompt_passphrase("foobar")
prompt = self.main_window.get_greeter().get_prompt()
self.assertThat(prompt.text, Eventually(Equals("")))
self.assertThat(greeter.shown, Eventually(Equals(True)))

## test_pin_screen_wrong_code()

lomiri.shell.tests.test_lock_screen.TestLockscreen.test_pin_screen_wrong_code | ( |  | self | ) |

    Entering the wrong pin code must not dismiss the lock screen.

Definition at line 68 of file test_lock_screen.py.

def test_pin_screen_wrong_code(self):
"""Entering the wrong pin code must not dismiss the lock screen."""
self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-pin"
self.launch_lomiri()
greeter = self.main_window.get_greeter()
if not greeter.tabletMode:
greeter.swipe()
self._wait_for_lockscreen()
self.main_window.enter_pin_code("4321")
pinentryField = self.main_window.get_pinentryField()
self.assertThat(pinentryField.text, Eventually(Equals("")))
else:
self._enter_prompt_passphrase("4231\n")
prompt = self.main_window.get_greeter().get_prompt()
self.assertThat(prompt.text, Eventually(Equals("")))
self.assertThat(greeter.shown, Eventually(Equals(True)))

## Member Data Documentation

## scenarios

lomiri.shell.tests.test_lock_screen.TestLockscreen.scenarios = lomiri_scenarios.get_device_simulation_scenarios()

static

Definition at line 36 of file test_lock_screen.py.

The documentation for this class was generated from the following file:

- tests/autopilot/lomiri/shell/tests/test_lock_screen.py