Browse Source
Added a unit test for keyboard interrupt
pull/377/head
Loren Schlomer
5 years ago
No known key found for this signature in database
GPG Key ID: 82E6D9D4AA4CBB83
3 changed files with
20 additions and
1 deletions
-
cli/lesspass/core.py
-
cli/test-requirements.txt
-
cli/tests/test_interaction.py
|
|
@@ -52,3 +52,6 @@ def main(args=sys.argv[1:]): |
|
|
|
print("-" * 80) |
|
|
|
else: |
|
|
|
print(generated_password) |
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
main() |
|
|
@@ -1,4 +1,5 @@ |
|
|
|
tox |
|
|
|
pytest |
|
|
|
flake8 |
|
|
|
mock |
|
|
|
mock |
|
|
|
pexpect |
|
|
@@ -0,0 +1,15 @@ |
|
|
|
import unittest |
|
|
|
import pexpect |
|
|
|
import signal |
|
|
|
import time |
|
|
|
|
|
|
|
class TestInteraction(unittest.TestCase): |
|
|
|
def test_keyboard_interrupt(self): |
|
|
|
|
|
|
|
p = pexpect.spawn('/bin/bash -c "python lesspass/core.py --prompt"') |
|
|
|
time.sleep(1) |
|
|
|
|
|
|
|
p.kill(signal.SIGINT) |
|
|
|
p.expect(pexpect.EOF) |
|
|
|
|
|
|
|
self.assertEqual(p.before, b'Site: ') |