Adds ExtendedAppointent unit tests and simplifies Appointment's

This commit is contained in:
Sergi Delgado Segura
2020-04-15 15:44:31 +02:00
parent 4e1c3e83cf
commit 8e3caadc5c
3 changed files with 59 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import struct
import binascii
import pytest
from pytest import fixture
from common.appointment import Appointment
@@ -29,8 +30,6 @@ def appointment_data():
def test_init_appointment(appointment_data):
# The appointment has no checks whatsoever, since the inspector is the one taking care or that, and the only one
# creating appointments.
# DISCUSS: whether this makes sense by design or checks should be ported from the inspector to the appointment
# 35-appointment-checks
appointment = Appointment(
appointment_data["locator"],
appointment_data["start_time"],
@@ -78,13 +77,9 @@ def test_from_dict(appointment_data):
prev_val = appointment_data[key]
appointment_data[key] = None
try:
with pytest.raises(ValueError, match="Wrong appointment data"):
Appointment.from_dict(appointment_data)
assert False
except ValueError:
appointment_data[key] = prev_val
assert True
def test_serialize(appointment_data):