Ejemplo n.º 1
0
 def get(self, postId):
     """Endpoint that gets all questions"""
     time_start = time.time()
     return_data = QuestionServices.getAllQuestions(postId)
     time_end = time.time()
     monitor(time_start, time_end, path, "get")
     return return_data["data"], return_data["status"], {'message': return_data["message"]}
Ejemplo n.º 2
0
 def post(self):
     """Endpoint for creating a single question"""
     time_start = time.time()
     args = new_question.parse_args()
     return_data = QuestionServices.createNewQuestion(args)
     time_end = time.time()
     monitor(time_start, time_end, path, "post")
     return return_data["data"], return_data["status"], {'message': return_data["message"]}
Ejemplo n.º 3
0
 def get(self, questionId):
     """Endpoint that gets a single questions"""
     time_start = time.time()
     args = {}
     args['questionId'] = questionId
     return_data = QuestionServices.getQuestion(args)
     time_end = time.time()
     monitor(time_start, time_end, path + "questionId", "get")
     return return_data["data"], return_data["status"], {'message': return_data["message"]}
Ejemplo n.º 4
0
 def put(self, questionId):
     """Endpoint that update a single answer"""
     time_start = time.time()
     args = answer.parse_args()
     args['questionId'] = questionId
     return_data = QuestionServices.updateQuestion(args)
     time_end = time.time()
     monitor(time_start, time_end, path + "questionId/respuesta/", "put")
     return return_data["data"], return_data["status"], {'message': return_data["message"]}
Ejemplo n.º 5
0
 def test_update_question_answer(self):
     response = QuestionServices.updateQuestion(new_answer)
     assert response["status"] == 200
     assert response["message"] == 'Pregunta actualizada satisfactoriamente'
     logging.debug(
         str(UserTransactions.getUserActivities(new_answer["facebookId"])))
     assert len(
         UserTransactions.getUserActivities(
             new_answer["facebookId"])["activities"]) != 0
Ejemplo n.º 6
0
 def test_new_question(self):
     response = QuestionServices.createNewQuestion(new_question)
     assert response["status"] == 201
     assert response["message"] == 'Pregunta creada satisfactoriamente'
     logging.debug(
         str(UserTransactions.getUserActivities(
             new_question["facebookId"])))
     assert len(
         UserTransactions.getUserActivities(
             new_question["facebookId"])["activities"]) != 0
Ejemplo n.º 7
0
 def test_get_question_id(self):
     response = QuestionServices.getQuestion(
         registered_credentials_with_question)
     assert response["status"] == 200
     assert response["message"] == 'Pregunta obtenida satisfactoriamente'
Ejemplo n.º 8
0
 def test_get_all_questions(self):
     response = QuestionServices.getAllQuestions(postId)
     assert response["status"] == 200
     assert response["message"] == 'Preguntas obtenidas satisfactoriamente'