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()
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)
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()
def test_login_form_should_accept_valid_username_and_password(self): with app.test_request_context(): form = LoginForm(username='******', password='******') assert_true(form.validate())
def test_login_form_should_validate_the_length_of_password(self): with app.test_request_context(): form = LoginForm(username='******', password='******') assert_false(form.validate())
def test_login_form_should_validate_presence_of_password(self): with app.test_request_context(): form = LoginForm(username='******', password=None) assert_false(form.validate())
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)
def test_login_form_should_accept_valid_username_and_password(self): with app.test_request_context(): form = LoginForm(username="******", password="******") assert_true(form.validate())
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
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)
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)
def setUpClass(cls): with app.test_request_context(): cls.user = User() cls.user.username = '******' cls.user.password = '******' cls.user.save()
def test_login_form_should_validate_presence_of_password(self): with app.test_request_context(): form = LoginForm(username="******", password=None) assert_false(form.validate())
def test_login_form_should_validate_the_length_of_password(self): with app.test_request_context(): form = LoginForm(username="******", password="******") assert_false(form.validate())
def setUpClass(cls): with app.test_request_context(): cls.user = User() cls.user.username = "******" cls.user.password = "******" cls.user.save()
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)