Pārlūkot izejas kodu

Add and fix failing test

Fixes #737
tags/mobile-v9.7.2
Guillaume Vincent pirms 1 gada
vecāks
revīzija
8c133e6ccb
5 mainītis faili ar 15 papildinājumiem un 14 dzēšanām
  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 Parādīt failu

@@ -1 +0,0 @@


+ 7
- 4
cli/tests/test_fingerprint.py Parādīt failu

@@ -1,7 +1,10 @@
import unittest

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 Parādīt failu

@@ -1,13 +1,11 @@
import unittest
import pexpect
import signal
import time

import sys

import argparse
from lesspass.cli import range_type


class TestFunctional(unittest.TestCase):
def test_length_below_the_minimum(self):
p = pexpect.spawn(
@@ -15,13 +13,15 @@ class TestFunctional(unittest.TestCase):
)
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):
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):
range_type('2')
range_type("2")

def test_exclude(self):
p = pexpect.spawn(


+ 0
- 1
cli/tests/test_interaction.py Parādīt failu

@@ -1,7 +1,6 @@
import unittest
import pexpect
import signal
import time


class TestInteraction(unittest.TestCase):


+ 1
- 1
cli/tests/test_password_generation.py Parādīt failu

@@ -156,7 +156,7 @@ class TestPassword(unittest.TestCase):

def test_get_set_of_characters_with_several_rules_and_exclude(self):
self.assertEqual(
password._get_set_of_characters(["lowercase", "digits"], 'iy4!'),
password._get_set_of_characters(["lowercase", "digits"], "iy4!"),
"abcdefghjklmnopqrstuvwxz012356789",
)



Notiek ielāde…
Atcelt
Saglabāt