Пример #1
0
    def test_when_value_is_equal_from_original_password_value_returns_true(
            self):
        original_password = '******'
        pass_a = Password(FakeEncryptor)
        pass_a.value = original_password

        assert bool(pass_a == original_password) is True
Пример #2
0
    def test_when_password_is_strong_stores_it_encrypted(self):
        password = '******'
        password_value = Password(FakeEncryptor)
        password_value.value = password

        assert password_value.value != password
Пример #3
0
 def test_when_password_is_not_strong_raises_password_strength_error(self):
     with pytest.raises(PasswordStrengthError):
         password_value = Password(FakeEncryptor)
         password_value.value = 'pass'
Пример #4
0
    def test_has_encrypted_value(self):
        pass_a = Password(FakeEncryptor)
        pass_a.value = 'P@ssword9'

        assert pass_a.value in str(pass_a)
Пример #5
0
    def test_when_value_is_different_from_original_password_value_returns_false(
            self):
        pass_a = Password(FakeEncryptor)
        pass_a.value = 'P@ssword9'

        assert bool(pass_a == 'p@ssword9') is False