@@ -1 +0,0 @@ | |||||
@@ -1,7 +1,10 @@ | |||||
import unittest | |||||
from lesspass.fingerprint import get_mnemonic | from lesspass.fingerprint import get_mnemonic | ||||
def test_get_fingerprint(): | |||||
assert get_mnemonic(b"password") == "⚗️🗄️🍺" | |||||
assert get_mnemonic(b"Password12345") == "🚑🛏️💷" | |||||
assert get_mnemonic(b"Ma$$W0rld!@#$%^&*()<gamma>") == "📈💷💷" | |||||
class TestFingerprint(unittest.TestCase): | |||||
def test_get_fingerprint(self): | |||||
self.assertEqual(get_mnemonic("passwor"), "🏨 🍴 🏁") | |||||
self.assertEqual(get_mnemonic("Password12345"), "🚑 🛏️ 💷") | |||||
self.assertEqual(get_mnemonic("Ma$$W0rld!@#$%^&*()<gamma>"), "📈 💷 💷") |
@@ -1,13 +1,11 @@ | |||||
import unittest | import unittest | ||||
import pexpect | import pexpect | ||||
import signal | |||||
import time | |||||
import sys | |||||
import argparse | import argparse | ||||
from lesspass.cli import range_type | from lesspass.cli import range_type | ||||
class TestFunctional(unittest.TestCase): | class TestFunctional(unittest.TestCase): | ||||
def test_length_below_the_minimum(self): | def test_length_below_the_minimum(self): | ||||
p = pexpect.spawn( | p = pexpect.spawn( | ||||
@@ -15,13 +13,15 @@ class TestFunctional(unittest.TestCase): | |||||
) | ) | ||||
output = p.read().decode() | output = p.read().decode() | ||||
self.assertTrue("error: argument -L/--length: 2 is out of range, choose in [5-35]" in output) | |||||
self.assertTrue( | |||||
"error: argument -L/--length: 2 is out of range, choose in [5-35]" in output | |||||
) | |||||
def test_length_range_type(self): | def test_length_range_type(self): | ||||
self.assertEqual(range_type('5'), 5) | |||||
self.assertEqual(range_type('35'), 35) | |||||
self.assertEqual(range_type("5"), 5) | |||||
self.assertEqual(range_type("35"), 35) | |||||
with self.assertRaises(argparse.ArgumentTypeError): | with self.assertRaises(argparse.ArgumentTypeError): | ||||
range_type('2') | |||||
range_type("2") | |||||
def test_exclude(self): | def test_exclude(self): | ||||
p = pexpect.spawn( | p = pexpect.spawn( | ||||
@@ -1,7 +1,6 @@ | |||||
import unittest | import unittest | ||||
import pexpect | import pexpect | ||||
import signal | import signal | ||||
import time | |||||
class TestInteraction(unittest.TestCase): | class TestInteraction(unittest.TestCase): | ||||
@@ -156,7 +156,7 @@ class TestPassword(unittest.TestCase): | |||||
def test_get_set_of_characters_with_several_rules_and_exclude(self): | def test_get_set_of_characters_with_several_rules_and_exclude(self): | ||||
self.assertEqual( | self.assertEqual( | ||||
password._get_set_of_characters(["lowercase", "digits"], 'iy4!'), | |||||
password._get_set_of_characters(["lowercase", "digits"], "iy4!"), | |||||
"abcdefghjklmnopqrstuvwxz012356789", | "abcdefghjklmnopqrstuvwxz012356789", | ||||
) | ) | ||||