Parcourir la source

Add and fix failing test

Fixes #737
tags/mobile-v9.7.2
Guillaume Vincent il y a 1 an
Parent
révision
8c133e6ccb
5 fichiers modifiés avec 15 ajouts et 14 suppressions
  1. +0
    -1
      cli/tests/__init__.py
  2. +7
    -4
      cli/tests/test_fingerprint.py
  3. +7
    -7
      cli/tests/test_functional.py
  4. +0
    -1
      cli/tests/test_interaction.py
  5. +1
    -1
      cli/tests/test_password_generation.py

+ 0
- 1
cli/tests/__init__.py Voir le fichier

@@ -1 +0,0 @@


+ 7
- 4
cli/tests/test_fingerprint.py Voir le fichier

@@ -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>"), "📈 💷 💷")

+ 7
- 7
cli/tests/test_functional.py Voir le fichier

@@ -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(


+ 0
- 1
cli/tests/test_interaction.py Voir le fichier

@@ -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):


+ 1
- 1
cli/tests/test_password_generation.py Voir le fichier

@@ -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",
) )




Chargement…
Annuler
Enregistrer