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

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
 lomiri_geometry_args
 
 grid_size
 
- Protected Attributes inherited from lomiri.shell.tests.LomiriTestCase
 _proxy
 
 _qml_mock_enabled
 
 _data_dirs_mock_enabled
 
 _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.

112 def _enter_pin_passphrase(self, passphrase):
113 """Enter the password specified in 'passphrase' into the password entry
114 field of the pin lock screen.
115
116 :param passphrase: The string you want to enter.
117 :raises: TypeError if passphrase is not a string.
118
119 """
120 if not isinstance(passphrase, str):
121 raise TypeError(
122 "'passphrase' parameter must be a string, not %r."
123 % type(passphrase)
124 )
125
126 pin_entry_field = self.main_window.get_pinentryField()
127 # pinentryField should automatically have focus
128 self.keyboard.type(passphrase)
129 logger.debug("Typed passphrase: %s", pin_entry_field.text)
130 self.assertEqual(pin_entry_field.text, passphrase)
131 self.keyboard.type("\n")
132

◆ _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.

133 def _enter_prompt_passphrase(self, passphrase):
134 """Enter the password specified in 'passphrase' into the password entry
135 field of the main user list's prompt.
136
137 :param passphrase: The string you want to enter.
138 :raises: TypeError if passphrase is not a string.
139
140 """
141 if not isinstance(passphrase, str):
142 raise TypeError(
143 "'passphrase' parameter must be a string, not %r."
144 % type(passphrase)
145 )
146
147 prompt = self.main_window.get_greeter().get_prompt()
148 prompt.write(passphrase)
149 logger.debug("Typed passphrase: %s", prompt.text)
150 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.

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

◆ 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.

53 def test_can_unlock_passphrase_screen(self):
54 """Must be able to unlock the passphrase entry screen."""
55
56 self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-passphrase"
57 self.launch_lomiri()
58 greeter = self.main_window.get_greeter()
59
60 if not greeter.tabletMode:
61 greeter.swipe()
62 self._wait_for_lockscreen()
63 self._enter_pin_passphrase("password")
64 else:
65 self._enter_prompt_passphrase("password")
66 self.assertThat(greeter.shown, Eventually(Equals(False)))
67

◆ 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.

38 def test_can_unlock_pin_screen(self):
39 """Must be able to unlock the PIN entry lock screen."""
40
41 self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-pin"
42 self.launch_lomiri()
43 greeter = self.main_window.get_greeter()
44
45 if not greeter.tabletMode:
46 greeter.swipe()
47 self._wait_for_lockscreen()
48 self.main_window.enter_pin_code("1234")
49 else:
50 self._enter_prompt_passphrase("1234\n")
51 self.assertThat(greeter.shown, Eventually(Equals(False)))
52

◆ 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.

86 def test_passphrase_screen_wrong_password(self):
87 """Entering the wrong password must not dismiss the lock screen."""
88 self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-passphrase"
89 self.launch_lomiri()
90 greeter = self.main_window.get_greeter()
91
92 if not greeter.tabletMode:
93 greeter.swipe()
94 self._wait_for_lockscreen()
95 self._enter_pin_passphrase("foobar")
96 pinentryField = self.main_window.get_pinentryField()
97 self.assertThat(pinentryField.text, Eventually(Equals("")))
98 else:
99 self._enter_prompt_passphrase("foobar")
100 prompt = self.main_window.get_greeter().get_prompt()
101 self.assertThat(prompt.text, Eventually(Equals("")))
102 self.assertThat(greeter.shown, Eventually(Equals(True)))
103

◆ 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.

68 def test_pin_screen_wrong_code(self):
69 """Entering the wrong pin code must not dismiss the lock screen."""
70 self._environment['LIBLIGHTDM_MOCK_MODE'] = "single-pin"
71 self.launch_lomiri()
72 greeter = self.main_window.get_greeter()
73
74 if not greeter.tabletMode:
75 greeter.swipe()
76 self._wait_for_lockscreen()
77 self.main_window.enter_pin_code("4321")
78 pinentryField = self.main_window.get_pinentryField()
79 self.assertThat(pinentryField.text, Eventually(Equals("")))
80 else:
81 self._enter_prompt_passphrase("4231\n")
82 prompt = self.main_window.get_greeter().get_prompt()
83 self.assertThat(prompt.text, Eventually(Equals("")))
84 self.assertThat(greeter.shown, Eventually(Equals(True)))
85

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: