Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

84 lignes
2.4 KiB

  1. import unittest
  2. from lesspass.password import generate_password
  3. class TestPassword(unittest.TestCase):
  4. def test_generate_password(self):
  5. profile = {
  6. "site": "example.org",
  7. "login": "contact@example.org",
  8. "lowercase": True,
  9. "uppercase": True,
  10. "digits": True,
  11. "symbols": True,
  12. "length": 16,
  13. "counter": 1,
  14. }
  15. master_password = "password"
  16. self.assertEqual(
  17. generate_password(profile, master_password), "WHLpUL)e00[iHR+w"
  18. )
  19. def test_generate_password_2(self):
  20. profile = {
  21. "site": "example.org",
  22. "login": "contact@example.org",
  23. "lowercase": True,
  24. "uppercase": True,
  25. "digits": True,
  26. "symbols": False,
  27. "length": 14,
  28. "counter": 2,
  29. }
  30. master_password = "password"
  31. self.assertEqual(generate_password(profile, master_password), "MBAsB7b1Prt8Sl")
  32. def test_generate_password_3(self):
  33. profile = {
  34. "site": "example.org",
  35. "login": "contact@example.org",
  36. "lowercase": False,
  37. "uppercase": False,
  38. "digits": True,
  39. "symbols": False,
  40. "length": 16,
  41. "counter": 1,
  42. }
  43. master_password = "password"
  44. self.assertEqual(
  45. generate_password(profile, master_password), "8742368585200667"
  46. )
  47. def test_generate_password_4(self):
  48. profile = {
  49. "site": "example.org",
  50. "login": "contact@example.org",
  51. "lowercase": True,
  52. "uppercase": True,
  53. "digits": False,
  54. "symbols": True,
  55. "length": 16,
  56. "counter": 1,
  57. }
  58. master_password = "password"
  59. self.assertEqual(
  60. generate_password(profile, master_password), "s>{F}RwkN/-fmM.X"
  61. )
  62. def test_generate_password_nrt_328(self):
  63. profile = {
  64. "site": "site",
  65. "login": "login",
  66. "lowercase": True,
  67. "uppercase": True,
  68. "digits": True,
  69. "symbols": True,
  70. "length": 16,
  71. "counter": 10,
  72. }
  73. master_password = "test"
  74. self.assertEqual(
  75. generate_password(profile, master_password), "XFt0F*,r619:+}[."
  76. )