Example #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()
Example #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()
Example #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)
Example #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)
Example #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()
Example #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())
Example #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())
Example #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())
Example #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)
Example #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())
Example #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
Example #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)
Example #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)
Example #14
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.user = User()
         cls.user.username = '******'
         cls.user.password = '******'
         cls.user.save()
Example #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
Example #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())
Example #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())
Example #18
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.user = User()
         cls.user.username = '******'
         cls.user.password = '******'
         cls.user.save()
Example #19
0
 def setUpClass(cls):
     with app.test_request_context():
         cls.user = User()
         cls.user.username = "******"
         cls.user.password = "******"
         cls.user.save()
Example #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)