1210 |
1210 |
login(app)
|
1211 |
1211 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1212 |
1212 |
resp = resp.click('Settings')
|
1213 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1213 |
assert 'Manage exception sources' not in resp.text
|
1214 |
1214 |
|
1215 |
1215 |
TimePeriod.objects.create(
|
1216 |
1216 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1218 |
1218 |
|
1219 |
1219 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1220 |
1220 |
resp = resp.click('Settings')
|
1221 |
|
assert 'Import exceptions from .ics' in resp.text
|
1222 |
|
resp = resp.click('upload')
|
|
1221 |
assert 'Manage exception sources' in resp.text
|
|
1222 |
resp = resp.click('manage exceptions')
|
1223 |
1223 |
assert "To add new exceptions, you can upload a file or specify an address to a remote calendar." in resp
|
1224 |
1224 |
resp = resp.form.submit(status=200)
|
1225 |
1225 |
assert 'Please provide an ICS File or an URL.' in resp.text
|
1226 |
1226 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1227 |
1227 |
resp = resp.click('Settings')
|
1228 |
|
resp = resp.click('upload')
|
|
1228 |
resp = resp.click('manage exceptions')
|
1229 |
1229 |
resp.form['ics_file'] = Upload('exceptions.ics', b'invalid content', 'text/calendar')
|
1230 |
1230 |
resp = resp.form.submit(status=200)
|
1231 |
1231 |
assert 'File format is invalid' in resp.text
|
... | ... | |
1259 |
1259 |
END:VCALENDAR"""
|
1260 |
1260 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1261 |
1261 |
resp = resp.click('Settings')
|
1262 |
|
resp = resp.click('upload')
|
|
1262 |
resp = resp.click('manage exceptions')
|
1263 |
1263 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_exceptions, 'text/calendar')
|
1264 |
1264 |
resp = resp.form.submit(status=302)
|
1265 |
1265 |
assert TimePeriodException.objects.filter(desk=desk).count() == 1
|
... | ... | |
1285 |
1285 |
login(app)
|
1286 |
1286 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1287 |
1287 |
resp = resp.click('Settings')
|
1288 |
|
resp = resp.click('upload')
|
|
1288 |
resp = resp.click('manage exceptions')
|
1289 |
1289 |
ics_with_recurrent_exceptions = b"""BEGIN:VCALENDAR
|
1290 |
1290 |
VERSION:2.0
|
1291 |
1291 |
PRODID:-//foo.bar//EN
|
... | ... | |
1309 |
1309 |
login(app)
|
1310 |
1310 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1311 |
1311 |
resp = resp.click('Settings')
|
1312 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1312 |
assert 'Manage exception sources' not in resp.text
|
1313 |
1313 |
|
1314 |
1314 |
TimePeriod.objects.create(
|
1315 |
1315 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1317 |
1317 |
|
1318 |
1318 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1319 |
1319 |
resp = resp.click('Settings')
|
1320 |
|
resp = resp.click('upload')
|
|
1320 |
resp = resp.click('manage exceptions')
|
1321 |
1321 |
|
1322 |
1322 |
assert 'ics_file' in resp.form.fields
|
1323 |
1323 |
assert 'ics_url' in resp.form.fields
|
... | ... | |
1353 |
1353 |
login(app)
|
1354 |
1354 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1355 |
1355 |
resp = resp.click('Settings')
|
1356 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1356 |
assert 'Manage exception sources' not in resp.text
|
1357 |
1357 |
|
1358 |
1358 |
TimePeriod.objects.create(
|
1359 |
1359 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1361 |
1361 |
|
1362 |
1362 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1363 |
1363 |
resp = resp.click('Settings')
|
1364 |
|
resp = resp.click('upload')
|
|
1364 |
resp = resp.click('manage exceptions')
|
1365 |
1365 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1366 |
1366 |
mocked_response = mock.Mock()
|
1367 |
1367 |
mocked_response.text = """BEGIN:VCALENDAR
|
... | ... | |
1388 |
1388 |
login(app)
|
1389 |
1389 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1390 |
1390 |
resp = resp.click('Settings')
|
1391 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1391 |
assert 'Manage exception sources' not in resp.text
|
1392 |
1392 |
|
1393 |
1393 |
TimePeriod.objects.create(
|
1394 |
1394 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1396 |
1396 |
|
1397 |
1397 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1398 |
1398 |
resp = resp.click('Settings')
|
1399 |
|
resp = resp.click('upload')
|
|
1399 |
resp = resp.click('manage exceptions')
|
1400 |
1400 |
|
1401 |
1401 |
assert 'ics_file' in resp.form.fields
|
1402 |
1402 |
assert 'ics_url' in resp.form.fields
|
... | ... | |
1420 |
1420 |
login(app)
|
1421 |
1421 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1422 |
1422 |
resp = resp.click('Settings')
|
1423 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1423 |
assert 'Manage exception sources' not in resp.text
|
1424 |
1424 |
|
1425 |
1425 |
TimePeriod.objects.create(
|
1426 |
1426 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1428 |
1428 |
|
1429 |
1429 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1430 |
1430 |
resp = resp.click('Settings')
|
1431 |
|
resp = resp.click('upload')
|
|
1431 |
resp = resp.click('manage exceptions')
|
1432 |
1432 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1433 |
1433 |
mocked_response = mock.Mock()
|
1434 |
1434 |
mocked_response.status_code = 403
|
... | ... | |
1450 |
1450 |
login(app)
|
1451 |
1451 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1452 |
1452 |
resp = resp.click('Settings')
|
1453 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1453 |
assert 'Manage exception sources' not in resp.text
|
1454 |
1454 |
TimePeriod.objects.create(
|
1455 |
1455 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
1456 |
1456 |
)
|
1457 |
1457 |
|
1458 |
1458 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1459 |
1459 |
resp = resp.click('Settings')
|
1460 |
|
resp = resp.click('upload')
|
|
1460 |
resp = resp.click('manage exceptions')
|
1461 |
1461 |
resp.form['ics_url'] = 'https://example.com/foo.ics'
|
1462 |
1462 |
mocked_response = mock.Mock()
|
1463 |
1463 |
mocked_get.return_value = mocked_response
|
... | ... | |
1482 |
1482 |
# import a source
|
1483 |
1483 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1484 |
1484 |
resp = resp.click('Settings')
|
1485 |
|
resp = resp.click('upload')
|
|
1485 |
resp = resp.click('manage exceptions')
|
1486 |
1486 |
ics_with_recurrent_exceptions = b"""BEGIN:VCALENDAR
|
1487 |
1487 |
VERSION:2.0
|
1488 |
1488 |
PRODID:-//foo.bar//EN
|
... | ... | |
1502 |
1502 |
# import another one
|
1503 |
1503 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1504 |
1504 |
resp = resp.click('Settings')
|
1505 |
|
resp = resp.click('upload')
|
|
1505 |
resp = resp.click('manage exceptions')
|
1506 |
1506 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_recurrent_exceptions, 'text/calendar')
|
1507 |
1507 |
resp = resp.form.submit(status=302).follow()
|
1508 |
1508 |
assert TimePeriodException.objects.filter(desk=desk).count() == 4
|
... | ... | |
1512 |
1512 |
# delete the second one
|
1513 |
1513 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1514 |
1514 |
resp = resp.click('Settings')
|
1515 |
|
resp = resp.click('upload')
|
|
1515 |
resp = resp.click('manage exceptions')
|
1516 |
1516 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/delete' % source2.pk)
|
1517 |
1517 |
resp = resp.form.submit().follow()
|
1518 |
1518 |
assert TimePeriodException.objects.count() == 2
|
... | ... | |
1522 |
1522 |
# delete the first one
|
1523 |
1523 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1524 |
1524 |
resp = resp.click('Settings')
|
1525 |
|
resp = resp.click('upload')
|
|
1525 |
resp = resp.click('manage exceptions')
|
1526 |
1526 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/delete' % source1.pk)
|
1527 |
1527 |
resp = resp.form.submit().follow()
|
1528 |
1528 |
assert TimePeriodException.objects.count() == 0
|
... | ... | |
1552 |
1552 |
# import a source from a file
|
1553 |
1553 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1554 |
1554 |
resp = resp.click('Settings')
|
1555 |
|
resp = resp.click('upload')
|
|
1555 |
resp = resp.click('manage exceptions')
|
1556 |
1556 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_file_content, 'text/calendar')
|
1557 |
1557 |
resp = resp.form.submit(status=302).follow()
|
1558 |
1558 |
assert TimePeriodException.objects.filter(desk=desk).count() == 2
|
... | ... | |
1564 |
1564 |
# replace the source
|
1565 |
1565 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1566 |
1566 |
resp = resp.click('Settings')
|
1567 |
|
resp = resp.click('upload')
|
|
1567 |
resp = resp.click('manage exceptions')
|
1568 |
1568 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/replace' % source.pk)
|
1569 |
1569 |
resp.form['ics_newfile'] = Upload('exceptions.ics', ics_file_content, 'text/calendar')
|
1570 |
1570 |
resp = resp.form.submit().follow()
|
... | ... | |
1600 |
1600 |
# import a source from an url
|
1601 |
1601 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1602 |
1602 |
resp = resp.click('Settings')
|
1603 |
|
resp = resp.click('upload')
|
|
1603 |
resp = resp.click('manage exceptions')
|
1604 |
1604 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1605 |
1605 |
mocked_response = mock.Mock()
|
1606 |
1606 |
mocked_response.text = ics_url_content
|
... | ... | |
1614 |
1614 |
# refresh the source
|
1615 |
1615 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1616 |
1616 |
resp = resp.click('Settings')
|
1617 |
|
resp = resp.click('upload')
|
|
1617 |
resp = resp.click('manage exceptions')
|
1618 |
1618 |
mocked_response = mock.Mock()
|
1619 |
1619 |
mocked_response.text = ics_url_content
|
1620 |
1620 |
mocked_get.return_value = mocked_response
|
... | ... | |
1640 |
1640 |
login(app)
|
1641 |
1641 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1642 |
1642 |
resp = resp.click('Settings')
|
1643 |
|
resp = resp.click('upload') # TODO this view name is now incorrect, change it
|
|
1643 |
resp = resp.click('manage exceptions')
|
1644 |
1644 |
assert 'Holidays' in resp.text
|
1645 |
1645 |
assert 'disabled' not in resp.text
|
1646 |
1646 |
assert 'refresh' not in resp.text
|
... | ... | |
1648 |
1648 |
resp = resp.click('disable').follow()
|
1649 |
1649 |
assert not TimePeriodException.objects.exists()
|
1650 |
1650 |
|
1651 |
|
resp = resp.click('upload')
|
|
1651 |
resp = resp.click('manage exceptions')
|
1652 |
1652 |
assert 'Holidays' in resp.text
|
1653 |
1653 |
assert 'disabled' in resp.text
|
1654 |
1654 |
|
1655 |
1655 |
resp = resp.click('enable').follow()
|
1656 |
1656 |
assert TimePeriodException.objects.exists()
|
1657 |
1657 |
|
1658 |
|
resp = resp.click('upload')
|
|
1658 |
resp = resp.click('manage exceptions')
|
1659 |
1659 |
assert 'disabled' not in resp.text
|
1660 |
1660 |
|
1661 |
1661 |
def test_meetings_agenda_time_period_exception_source_try_disable_ics(app, admin_user):
|
... | ... | |
1670 |
1670 |
login(app)
|
1671 |
1671 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1672 |
1672 |
resp = resp.click('Settings')
|
1673 |
|
resp = resp.click('upload')
|
|
1673 |
resp = resp.click('manage exceptions')
|
1674 |
1674 |
assert 'test.ics' in resp.text
|
1675 |
1675 |
|
1676 |
1676 |
assert app.get('/manage/time-period-exceptions-source/%s/toggle' % source.pk, status=404)
|
1677 |
|
-
|