def test_authenticate_calledWithUserQueryRepositoryWhichRaisesQueryError_raiseServiceError( self): self.stub_auth_token_service.generate_auth_token.return_value = "fake" self.stub_user_query_repository.get_user_by_id.side_effect = QueryError( ) self.assertRaises(ServiceError, self.sut.authenticate, "666f6f2d6261722d71757578")
def test_getExerciseById_calledWithQueryRepositoryWhichThrowsQueryError_throwServiceError( self): self.stub_exercise_query_repository.get_exercise_by_id.side_effect = QueryError( ) self.assertRaises(ServiceError, self.sut.get_exercise_by_id, exercise_id='fakeid')
def test_getRanking_calledWithQueryRepositoryWhichRaisesQueryError_raiseServiceError(self): self.stub_user_query_repository.get_ranking.side_effect = QueryError() self.assertRaises(ServiceError, self.sut.get_ranking)
def test_getUserByAuthToken_calledWithQueryRepositoryWhichRaisesQueryError_raiseServiceError(self): self.stub_user_query_repository.get_user_by_auth_token.side_effect = QueryError() self.assertRaises(ServiceError, self.sut.get_user_by_auth_token, token='faketoken')
def test_getUserByCredentials_calledWithQueryRepositoryWhichRaisesQueryError_raiseServiceError(self): self.stub_user_query_repository.get_user_by_credentials.side_effect = QueryError() self.assertRaises(ServiceError, self.sut.get_user_by_credentials, email='*****@*****.**', password='******')
def test_getExerciseEvaluation_calledWithQueryRepositoryWhichThrowsQueryError_throwServiceError( self): self.stub_exercise_evaluation_query_repository.get_exercise_evaluation.side_effect = QueryError( ) self.assertRaises(ServiceError, self.sut.get_exercise_evaluation, 'fake', 'fake')
def test_validateAnswer_calledWithQueryRepositoryWhichThrowsQueryError_throwServiceError(self): self.stub_exercise_query_repository.get_exercise_by_id.side_effect = QueryError() self.assertRaises(ServiceError, self.sut.validate_answer, user_id='test_id', exercise_id='fakeid', time_left=10, answer='fakeanswer')