1940 |
1940 |
resp = app.get(
|
1941 |
1941 |
'/manage/agendas/%s/%d/%d/%d/' % (agenda.id, date.year, date.month, date.day), status=200
|
1942 |
1942 |
)
|
1943 |
|
assert len(ctx.captured_queries) == 15
|
|
1943 |
assert len(ctx.captured_queries) == 16
|
1944 |
1944 |
# day is displaying rows from 10am to 6pm,
|
1945 |
1945 |
# opening hours, 10am to 1pm gives top: 300%
|
1946 |
1946 |
# rest of the day, 1pm to 6(+1)pm gives 600%
|
... | ... | |
1950 |
1950 |
}
|
1951 |
1951 |
assert resp.pyquery.find('.exception-hours span')[0].text == 'Exception for the afternoon'
|
1952 |
1952 |
|
|
1953 |
# display excluded period
|
|
1954 |
date += datetime.timedelta(days=7)
|
|
1955 |
TimePeriod.objects.create(
|
|
1956 |
agenda=agenda, weekday=today.weekday(), start_time=datetime.time(14, 0), end_time=datetime.time(23, 0)
|
|
1957 |
)
|
|
1958 |
resp = app.get('/manage/agendas/%s/%d/%d/%d/' % (agenda.id, date.year, date.month, date.day), status=200)
|
|
1959 |
assert resp.pyquery.find('.exception-hours')[0].attrib == {
|
|
1960 |
'class': 'exception-hours',
|
|
1961 |
'style': 'height: 500%; top: 400%;',
|
|
1962 |
}
|
|
1963 |
|
|
1964 |
# check excluded period is only displayed on relevant weekday
|
|
1965 |
date += datetime.timedelta(days=1)
|
|
1966 |
TimePeriod.objects.create(
|
|
1967 |
desk=desk1, weekday=date.weekday(), start_time=datetime.time(10, 0), end_time=datetime.time(18, 0)
|
|
1968 |
)
|
|
1969 |
resp = app.get('/manage/agendas/%s/%d/%d/%d/' % (agenda.id, date.year, date.month, date.day), status=200)
|
|
1970 |
assert resp.text.count('<tr') == 9
|
|
1971 |
assert 'exceptions-hours' not in resp.text
|
|
1972 |
|
1953 |
1973 |
|
1954 |
1974 |
def test_virtual_agenda_month_view(app, admin_user):
|
1955 |
1975 |
agenda = Agenda.objects.create(label='Virtual', kind='virtual')
|
... | ... | |
2038 |
2058 |
)
|
2039 |
2059 |
with CaptureQueriesContext(connection) as ctx:
|
2040 |
2060 |
resp = app.get('/manage/agendas/%s/%s/%s/' % (agenda.id, today.year, today.month))
|
2041 |
|
assert len(ctx.captured_queries) == 12
|
|
2061 |
assert len(ctx.captured_queries) == 13
|
|
2062 |
assert len(resp.pyquery.find('.exception-hours')) == 1
|
2042 |
2063 |
assert resp.pyquery.find('.exception-hours')[0].attrib == {
|
2043 |
2064 |
'class': 'exception-hours',
|
2044 |
2065 |
'style': 'height:800.0%;top:0.0%;width:48.0%;left:1.0%;',
|
2045 |
2066 |
'title': 'Exception for a December day',
|
2046 |
2067 |
}
|
2047 |
2068 |
|
|
2069 |
# display excluded period
|
|
2070 |
TimePeriod.objects.create(
|
|
2071 |
agenda=agenda, weekday=today.weekday(), start_time=datetime.time(13, 0), end_time=datetime.time(23, 0)
|
|
2072 |
)
|
|
2073 |
resp = app.get('/manage/agendas/%s/%s/%s/' % (agenda.id, today.year, today.month))
|
|
2074 |
assert len(resp.pyquery.find('.exception-hours')) == 11 # five occurences on two desks
|
|
2075 |
assert resp.pyquery.find('.exception-hours')[0].attrib == {
|
|
2076 |
'class': 'exception-hours',
|
|
2077 |
'style': 'height:500.0%;top:300.0%;width:48.0%;left:1.0%;',
|
|
2078 |
}
|
|
2079 |
assert resp.pyquery.find('.exception-hours')[1].attrib == {
|
|
2080 |
'class': 'exception-hours',
|
|
2081 |
'style': 'height:500.0%;top:300.0%;width:48.0%;left:50.0%;',
|
|
2082 |
}
|
|
2083 |
|
2048 |
2084 |
|
2049 |
2085 |
def test_virtual_agenda_settings_empty(app, admin_user):
|
2050 |
2086 |
agenda = Agenda.objects.create(label='My Virtual agenda', kind='virtual')
|
2051 |
|
-
|