def test_failed_check_password_hash(self, mock_request, mock_find_by_username, mock_check_password_hash): mock_request.authorization = self.Authorization() with self.assertRaises(Unauthorized): auth()
def authenticate(): return helper.auth()
def test_none_find_by_username(self, mock_request, mock_find_by_username): mock_request.authorization = self.Authorization() with self.assertRaises(NotFound): auth()
def test_without_authorization_password(self, mock_request): mock_request.authorization = self.Authorization() mock_request.authorization.password = None with self.assertRaises(Unauthorized): auth()
def test_without_authorization_username(self, mock_request): mock_request.authorization = self.Authorization() mock_request.authorization.username = None with self.assertRaises(Unauthorized): auth()
def test_without_authorization(self, mock_request): mock_request.authorization = None with self.assertRaises(Unauthorized): auth()
def test_success(self, mock_request, mock_find_by_username, mock_check_password_hash): mock_request.authorization = self.Authorization() response = auth() assert self.success_schema.validate(response)