3037 |
3037 |
assert resp.text.count('Swimming') == 2 # 1 booking + legend
|
3038 |
3038 |
assert 'Booking colors:' in resp.text
|
3039 |
3039 |
assert len(resp.pyquery.find('div.booking-colors span.booking-color-label')) == 2
|
|
3040 |
|
|
3041 |
|
|
3042 |
@freezegun.freeze_time('2022-03-01 14:00')
|
|
3043 |
def test_agenda_day_and_month_views_weekday_indexes(app, admin_user):
|
|
3044 |
agenda = Agenda.objects.create(label='New Example', kind='meetings')
|
|
3045 |
desk = Desk.objects.create(agenda=agenda, label='New Desk')
|
|
3046 |
MeetingType.objects.create(agenda=agenda, label='Bar', duration=30)
|
|
3047 |
today = datetime.date.today()
|
|
3048 |
TimePeriod.objects.create(
|
|
3049 |
desk=desk,
|
|
3050 |
weekday=today.weekday(),
|
|
3051 |
start_time=datetime.time(10, 0),
|
|
3052 |
end_time=datetime.time(14, 0),
|
|
3053 |
weekday_indexes=[1, 3],
|
|
3054 |
)
|
|
3055 |
TimePeriod.objects.create(
|
|
3056 |
desk=desk,
|
|
3057 |
weekday=today.weekday(),
|
|
3058 |
start_time=datetime.time(14, 0),
|
|
3059 |
end_time=datetime.time(17, 0),
|
|
3060 |
weekday_indexes=[3, 5],
|
|
3061 |
)
|
|
3062 |
login(app)
|
|
3063 |
|
|
3064 |
# check day view
|
|
3065 |
resp = app.get('/manage/agendas/%s/%s/%s/%s/' % (agenda.pk, today.year, today.month, today.day))
|
|
3066 |
assert resp.text.count('<tr') == 5 # 10->14
|
|
3067 |
assert 'style="height: 400%; top: 0%;"' in resp.text
|
|
3068 |
|
|
3069 |
resp = app.get('/manage/agendas/%s/%s/%s/%s/' % (agenda.pk, today.year, today.month, today.day + 7))
|
|
3070 |
assert 'No opening hours this day.' in resp.text
|
|
3071 |
|
|
3072 |
resp = app.get('/manage/agendas/%s/%s/%s/%s/' % (agenda.pk, today.year, today.month, today.day + 14))
|
|
3073 |
assert resp.text.count('<tr') == 8 # 10->14, 14->17
|
|
3074 |
assert 'style="height: 700%; top: 0%;"' in resp.text
|
|
3075 |
|
|
3076 |
resp = app.get('/manage/agendas/%s/%s/%s/%s/' % (agenda.pk, today.year, today.month, today.day + 21))
|
|
3077 |
assert 'No opening hours this day.' in resp.text
|
|
3078 |
|
|
3079 |
resp = app.get('/manage/agendas/%s/%s/%s/%s/' % (agenda.pk, today.year, today.month, today.day + 28))
|
|
3080 |
assert resp.text.count('<tr') == 4 # 14->17
|
|
3081 |
assert 'style="height: 300%; top: 0%;"' in resp.text
|
|
3082 |
|
|
3083 |
# check month view
|
|
3084 |
resp = app.get('/manage/agendas/%s/%s/%s/' % (agenda.pk, today.year, today.month))
|
|
3085 |
assert resp.text.count('height:') == 3
|
|
3086 |
assert resp.text.count('height:400.0%') == 1
|
|
3087 |
assert resp.text.count('height:700.0%') == 1
|
|
3088 |
assert resp.text.count('height:300.0%') == 1
|
3040 |
|
-
|