Adds some missing tests

This commit is contained in:
Sergi Delgado Segura
2019-10-22 16:38:28 +01:00
parent 9d9d7b1e5b
commit af0e9c81b5
7 changed files with 39 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
import json
import pytest
import requests
from os import urandom
from hashlib import sha256
from binascii import unhexlify
@@ -99,6 +100,16 @@ def test_request_appointment(new_appointment):
assert (all([status == "being_watched" for status in appointment_status]))
def test_request_random_appointment():
r = requests.get(url=PISA_API + "/get_appointment?locator=" + urandom(32).hex())
assert (r.status_code == 200)
received_appointments = json.loads(r.content)
appointment_status = [appointment.pop("status") for appointment in received_appointments]
assert (all([status == "not_found" for status in appointment_status]))
def test_add_appointment_multiple_times(new_appointment, n=MULTIPLE_APPOINTMENTS):
# Multiple appointments with the same locator should be valid
# DISCUSS: #34-store-identical-appointments