def test_foster(): now = date.today() parent = FosterParent(name="Kek", address="Bur 1337", phone_number="13371337", max_animals=1) foster = Foster(parent=parent, start_date=now) assert type(foster.parent) == FosterParent assert type(foster.start_date) == date assert type(foster.end_date) == type(None) assert foster.is_colliding(date=now + timedelta(days=1)) assert not foster.is_colliding(date=now - timedelta(days=1)) foster.end_date = now + timedelta(days=2) assert foster.is_colliding(date=now + timedelta(days=1)) assert not foster.is_colliding(date=now + timedelta(days=3))
def test_foster_parent(): parent = make_parent() assert type(parent.name) == str assert type(parent.address) == str assert type(parent.phone_number) == str assert type(parent.max_animals) == int assert type(parent.fosters) == list now = date.today() assert parent.has_animals(date=now) == 0 assert parent.is_available(date=now) foster = Foster(parent=parent, start_date=now - timedelta(days=1)) parent.fosters.append(foster) assert parent.has_animals(date=now) == 1 assert not parent.is_available(date=now) foster.end_date = now assert parent.has_animals(date=now + timedelta(days=1)) == 0 assert parent.is_available(date=now + timedelta(days=1))