Exemplo n.º 1
0
    def test_encrypt_password_failed(self, engine_mock):
        from nefertari.authentication import models

        field = Mock(params={"min_length": 10})
        field.name = "q"
        with pytest.raises(ValueError) as ex:
            models.encrypt_password(instance=None, new_value="foo", field=field)
        assert str(ex.value) == "`q`: Value length must be more than 10"
Exemplo n.º 2
0
    def test_encrypt_password(self, engine_mock):
        from nefertari.authentication import models

        field = Mock(params={"min_length": 1})
        encrypted = models.encrypt_password(instance=None, new_value="foo", field=field)
        assert models.crypt.match(encrypted)
        assert encrypted != "foo"
        assert encrypted == models.encrypt_password(instance=None, new_value=encrypted, field=field)
Exemplo n.º 3
0
 def test_encrypt_password_failed(self, engine_mock):
     from nefertari.authentication import models
     field = Mock(params={'min_length': 10})
     field.name = 'q'
     with pytest.raises(ValueError) as ex:
         models.encrypt_password(instance=None,
                                 new_value='foo',
                                 field=field)
     assert str(ex.value) == '`q`: Value length must be more than 10'
Exemplo n.º 4
0
 def test_encrypt_password(self, engine_mock):
     from nefertari.authentication import models
     field = Mock(params={'min_length': 1})
     encrypted = models.encrypt_password(instance=None,
                                         new_value='foo',
                                         field=field)
     assert models.crypt.match(encrypted)
     assert encrypted != 'foo'
     assert encrypted == models.encrypt_password(instance=None,
                                                 new_value=encrypted,
                                                 field=field)
Exemplo n.º 5
0
 def test_encrypt_password(self, engine_mock):
     from nefertari.authentication import models
     encrypted = models.encrypt_password('foo')
     assert models.crypt.match(encrypted)
     assert encrypted != 'foo'
     assert encrypted == models.encrypt_password(encrypted)