-3
POST /sinalizar_interesse/9/3/
means that 9 is interested(a) in 3.
Code:
def localiza_id(id_usuario):
for pess in database['PESSOA']:
if pess['id'] == id_usuario:
return 200
return 404
@app.route('/sinalizar_interesse/<int:id_interessada>/<int:id_alvo>', methods=['POST'])
def sinalizar_interesse(id_interessada, id_alvo):
pessoa_busca = (id_interessada)
pessoa_alvo = (id_alvo)
if (localiza_id(pessoa_busca) or localiza_id(pessoa_alvo)) == 404:
return 404
if (localiza_id(pessoa_busca) and localiza_id(pessoa_alvo)) == 200:
return 200
It is giving error in these tests. It should give the code 200, but independent of the test it returns 404.
I do not understand what is wrong, I do not know if it is the method because it is using method POST
and the tests use the method PUT
and I’m not getting code 200.
Testing:
#agora posso marcar interesse de 3 pra 9 e de 9 pra 3 sem problemas
r = requests.put('http://localhost:5003/sinalizar_interesse/9/3/')
self.assertEqual(r.status_code,200)
r = requests.put('http://localhost:5003/sinalizar_interesse/3/9/')
self.assertEqual(r.status_code,200)
The link http://localhost:5003//signal_interest/9/3/ does not imply anything in understanding the question... localhost is an environment on your machine, only you can access....
– MarceloBoni
Read: https://answall.com/questions/447033/interesse-tinder-localhost#comment858395_447033
– MarceloBoni