コード例 #1
0
ファイル: test_application.py プロジェクト: socialwifi/dila
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)
コード例 #2
0
ファイル: test_application.py プロジェクト: socialwifi/dila
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)
コード例 #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
コード例 #4
0
ファイル: test_application.py プロジェクト: socialwifi/dila
def test_authenticating_user_not_dila_permited(config_ldap_setup):
    assert not application.authenticate('howo01', 'bazinga').authenticated
コード例 #5
0
ファイル: test_application.py プロジェクト: socialwifi/dila
def test_authenticating_invalid_user(config_ldap_setup):
    assert not application.authenticate('hacker',
                                        'X" OR "a" = "A').authenticated
コード例 #6
0
ファイル: test_application.py プロジェクト: socialwifi/dila
def test_authenticating_user_without_password(config_ldap_setup):
    assert not application.authenticate('shco01', '').authenticated