Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Adds a another allocation form helper test
Browse files Browse the repository at this point in the history
  • Loading branch information
Denis Krienbühl committed Aug 28, 2015
1 parent 9c4e65a commit bd95952
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions onegov/town/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from datetime import date, datetime, time
from dateutil.rrule import MO, WE
from libres.db.models import Allocation
from onegov.core.utils import Bunch
from onegov.town.forms import (
DaypassAllocationForm,
ReservationForm,
Expand Down Expand Up @@ -187,6 +188,21 @@ def test_generate_datetimes():
]


def test_combine_datetime():
helper = AllocationFormHelpers()

helper.date = Bunch(data=date(2015, 1, 1))
helper.time = Bunch(data=None)
assert helper.combine_datetime('date', 'time') == datetime(2015, 1, 1)

helper.time = Bunch(data='12:00')
assert helper.combine_datetime('date', 'time') == datetime(2015, 1, 1, 12)

helper.date = Bunch(data=None)
helper.time = Bunch(data=None)
assert helper.combine_datetime('date', 'time') is None


def test_reservation_form_partly_available():
allocation = Allocation()

Expand Down

0 comments on commit bd95952

Please sign in to comment.