Exemplo n.º 1
0
def test_authenticating_user_superuser(config_ldap_setup):
    assert application.authenticate('admin', 'admin') == structures.User(
        authenticated=True,
        username='******',
        first_name='Super',
        last_name='Admin',
        is_superuser=True)
Exemplo n.º 2
0
def test_authenticating_user_not_superuser(config_ldap_setup):
    assert application.authenticate('shco01', 'bazinga') == structures.User(
        authenticated=True,
        username='******',
        first_name='Sheldon',
        last_name='Cooper',
        is_superuser=False)
Exemplo n.º 3
0
 def validate(self, *args, **kwargs):
     if super().validate(*args, **kwargs):
         self.user = application.authenticate(self.username.data,
                                              self.password.data)
         if self.user.authenticated:
             return True
         else:
             self.password.errors.append('Invalid login or password')
     return False
Exemplo n.º 4
0
def test_authenticating_user_not_dila_permited(config_ldap_setup):
    assert not application.authenticate('howo01', 'bazinga').authenticated
Exemplo n.º 5
0
def test_authenticating_invalid_user(config_ldap_setup):
    assert not application.authenticate('hacker',
                                        'X" OR "a" = "A').authenticated
Exemplo n.º 6
0
def test_authenticating_user_without_password(config_ldap_setup):
    assert not application.authenticate('shco01', '').authenticated