Exemplo n.º 1
0
    def test_failed_login(self):
        user = self.user

        client = Client(ag.wsgi_test_app, BaseResponse)
        topost = {
            'login_id': user.login_id,
            'password': '******',
            'login-form-submit-flag': '1'
        }
        resp = client.post('users/login', data=topost)
        assert resp.status_code == 200, resp.status
        assert b'Login failed!' in resp.data
Exemplo n.º 2
0
 def setup_class(cls):
     cls.c = Client(ag.wsgi_test_app, BaseResponse)
     cls.user = create_user_with_permissions()
     cls.user.reset_required = True
     db.sess.commit()
     cls.userid = login_client_as_user(cls.c,
                                       cls.user.login_id,
                                       cls.user.text_password,
                                       validate_login_response=False)
Exemplo n.º 3
0
    def test_inactive_login(self):
        user = self.user
        # set the user's inactive flag
        user.inactive_flag = True
        db.sess.commit()

        # log user in
        client = Client(ag.wsgi_test_app, BaseResponse)
        topost = {
            'login_id': user.login_id,
            'password': user.text_password,
            'login-form-submit-flag': '1'
        }
        req, resp = client.post('users/login',
                                data=topost,
                                follow_redirects=True)
        assert resp.status_code == 200, resp.status
        assert b'That user is inactive.' in resp.data
        assert req.url == 'http://localhost/users/login'
Exemplo n.º 4
0
 def setup_class(cls):
     cls.c = Client(ag.wsgi_test_app, BaseResponse)
     perms = [u'auth-manage', u'users-test1', u'users-test2']
     cls.userid = login_client_with_permissions(cls.c, perms)
Exemplo n.º 5
0
 def setup_class(cls):
     cls.c = Client(ag.wsgi_test_app, BaseResponse)
Exemplo n.º 6
0
 def setup_class(cls):
     cls.c = Client(ag.wsgi_test_app, BaseResponse)
     cls.userid = login_client_with_permissions(cls.c, u'prof-test-1',
                                                u'prof-test-2')
     cls.userid2 = create_user_with_permissions().id