def test_check_result_by_name(self): """ Test que comprueba la búsqueda de un resultado por su nombre de equipo local o visitante :return: """ result = False if (rService.getResultByLocal("Valencia") is not None): result = True elif (rService.getResultByVisit("Valencia") is not None): result = True self.assertTrue(result)
def test_name_team(self): """ Test que comprueba que el nombre del equipo buscado es el devuelto :return: """ result = Result() name = "" team = "Valencia" if (rService.getResultByLocal("Valencia") is not None): result = rService.getResultByLocal("Valencia") name = result.getTeamLocal() elif (rService.getResultByVisit("Valencia") is not None): result = rService.getResultByVisit("Valencia") name = result.getTeamVisit() self.assertEqual(name, team)
def getResultByVisit(visit): result = rService.getResultByVisit(visit) if (result is None): return jsonify(None) return jsonify(model_to_dict(result))
def getResult(id): result = rService.getResult(int(id)) if (result is None): return jsonify(None) return jsonify(model_to_dict(result))
def getResultBylocal(local): result = rService.getResultByLocal(local) if (result is None): return jsonify(None) return jsonify(model_to_dict(result))
def getResultBylocal(local): result = rService.getResultByLocal(local) if (result is None): return Response("404", status=404, mimetype='application/json') return jsonify(model_to_dict(result))
def insert(): response = rService.addResult() if (response == True): return "true" else: return "false"
def getResultByVisit(visit): result = rService.getResultByVisit(visit) if (result is None): return Response("404", status=404, mimetype='application/json') # return jsonify(None) return jsonify(model_to_dict(result))
def updateResult(id, rlocal, rvisit): response = rService.updateResult(id, rlocal, rvisit) if (response == True): return jsonify("true") else: return jsonify("false")
def test_check_local_score_result(self): """ Test que comprueba la búsqueda del marcador local de un partido :return: """ result = True if (rService.getResultLocal(1) is None): result = False self.assertTrue(result)
def test_check_all_results(self): """ Test que comprueba la búsqueda de todos los resultados :return: """ result = True if (rService.getAll() is None): result = False self.assertTrue(result)
def test_check_result_by_id(self): """ Test que comprueba la búsqueda de un resultados por su id :return: """ result = True if (rService.getResult(1) is None): result = False self.assertTrue(result)
def getAllResult(): result = rService.getAll() if (result is None): return Response("404", status=404, mimetype='application/json') resultList = [] for item in result: resultList.append(model_to_dict(item)) return make_response(jsonify(resultList), 200)
def getAllResult(): result = rService.getAll() if (result is None): return jsonify(None) resultList = [] for item in result: resultList.append(model_to_dict(item)) print(resultList) return make_response(jsonify(resultList), 200)
def recolect(): rService.inserDataResult() return 'Datos recolectados'
def deleteResult(id): status = rService.deleteResult(id) return jsonify(status)