Beispiel #1
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.client = app.test_client()
         cls.user = User()
         cls.user.username = '******'
         cls.user.password = '******'
         cls.user.save()
Beispiel #2
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.client = app.test_client()
         cls.user = User()
         cls.user.username = '******'
         cls.user.password = '******'
         cls.user.save()
Beispiel #3
0
    def test_should_be_able_to_load_a_user_by_a_given_identity(self):
        with app.test_request_context():
            identity = Identity(self.user.mongo_id)
            user = User.query.from_identity(identity)

            assert_equals(self.user, identity.user)
            assert_equals(self.user, user)
Beispiel #4
0
    def test_should_be_able_to_load_a_user_by_a_given_identity(self):
        with app.test_request_context():
            identity = Identity(self.user.mongo_id)
            user = User.query.from_identity(identity)

            assert_equals(self.user, identity.user)
            assert_equals(self.user, user)
Beispiel #5
0
    def test_should_get_connection_to_amazon_cloudfront_using_boto(self):
        with app.test_request_context():
            CloudFrontConnection = self.mocker.replace('boto.cloudfront.CloudFrontConnection')
            CloudFrontConnection(aws_access_key_id=app.config['AWS_ACCESS_KEY_ID'], aws_secret_access_key=app.config['AWS_SECRET_ACCESS_KEY'])
            self.mocker.result('connected')
            self.mocker.replay()

            from awsmanager.util import ConnectionManager
            connection = ConnectionManager.get_cloudfront_connection()
            assert_equals('connected', connection)
            self.mocker.verify()
Beispiel #6
0
 def test_login_form_should_accept_valid_username_and_password(self):
     with app.test_request_context():
         form = LoginForm(username='******', password='******')
         assert_true(form.validate())
Beispiel #7
0
 def test_login_form_should_validate_the_length_of_password(self):
     with app.test_request_context():
         form = LoginForm(username='******', password='******')
         assert_false(form.validate())
Beispiel #8
0
 def test_login_form_should_validate_presence_of_password(self):
     with app.test_request_context():
         form = LoginForm(username='******', password=None)
         assert_false(form.validate())
Beispiel #9
0
 def test_should_be_able_to_not_authenticate_an_existing_user_with_wrong_password(
         self):
     with app.test_request_context():
         authenticated, user = User.query.authenticate(username='******',
                                                       password='******')
         assert_false(authenticated)
Beispiel #10
0
 def test_login_form_should_accept_valid_username_and_password(self):
     with app.test_request_context():
         form = LoginForm(username="******", password="******")
         assert_true(form.validate())
Beispiel #11
0
 def test_should_be_able_to_not_authenticate_an_unexisting_user(self):
     with app.test_request_context():
         authenticated, user = User.query.authenticate(username='******', password='******')
         assert_false(authenticated)
         assert user is None
Beispiel #12
0
 def test_should_be_able_to_not_authenticate_an_existing_user_with_wrong_password(self):
     with app.test_request_context():
         authenticated, user = User.query.authenticate(username='******', password='******')
         assert_false(authenticated)
Beispiel #13
0
 def test_should_be_able_to_authenticate_an_existing_user_with_right_password(self):
     with app.test_request_context():
         authenticated, user = User.query.authenticate(username='******', password='******')
         assert_true(authenticated)
Beispiel #14
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.user = User()
         cls.user.username = '******'
         cls.user.password = '******'
         cls.user.save()
Beispiel #15
0
 def test_should_be_able_to_not_authenticate_an_unexisting_user(self):
     with app.test_request_context():
         authenticated, user = User.query.authenticate(username='******',
                                                       password='******')
         assert_false(authenticated)
         assert user is None
Beispiel #16
0
 def test_login_form_should_validate_presence_of_password(self):
     with app.test_request_context():
         form = LoginForm(username="******", password=None)
         assert_false(form.validate())
Beispiel #17
0
 def test_login_form_should_validate_the_length_of_password(self):
     with app.test_request_context():
         form = LoginForm(username="******", password="******")
         assert_false(form.validate())
Beispiel #18
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.user = User()
         cls.user.username = '******'
         cls.user.password = '******'
         cls.user.save()
Beispiel #19
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.user = User()
         cls.user.username = "******"
         cls.user.password = "******"
         cls.user.save()
Beispiel #20
0
 def test_should_be_able_to_authenticate_an_existing_user_with_right_password(
         self):
     with app.test_request_context():
         authenticated, user = User.query.authenticate(username='******',
                                                       password='******')
         assert_true(authenticated)