Commit 6e99fe9f authored by Patrick Kimber's avatar Patrick Kimber

pytest and factories #1181

parent 738e89b8
# -*- encoding: utf-8 -*-
import pytest
from datetime import date
from dateutil.relativedelta import relativedelta
from booking.service import (
BookingCount,
HtmlCalendar,
)
from booking.tests.scenario import demo_data
from booking.tests.factories import BookingFactory
def _demo_data():
# today
BookingFactory(
start_date=date.today(),
end_date=date.today()+relativedelta(days=2),
)
# in the past
start_date = date.today() + relativedelta(days=-10)
BookingFactory(
start_date=start_date,
end_date=start_date+relativedelta(days=3),
)
# in the future
start_date = date.today() + relativedelta(days=10)
BookingFactory(
start_date=start_date,
end_date=start_date+relativedelta(days=5),
)
@pytest.mark.django_db
def test_get_bookings():
demo_data()
_demo_data()
c = HtmlCalendar()
c._get_bookings()
@pytest.mark.django_db
def test_get_calendars():
demo_data()
_demo_data()
c = HtmlCalendar()
c.get_calendars()
......
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from datetime import (
datetime,
timedelta,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment