1251 |
1251 |
login(app)
|
1252 |
1252 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1253 |
1253 |
resp = resp.click('Settings')
|
1254 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1254 |
assert 'Manage exception sources' not in resp.text
|
1255 |
1255 |
|
1256 |
1256 |
TimePeriod.objects.create(
|
1257 |
1257 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1259 |
1259 |
|
1260 |
1260 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1261 |
1261 |
resp = resp.click('Settings')
|
1262 |
|
assert 'Import exceptions from .ics' in resp.text
|
1263 |
|
resp = resp.click('upload')
|
|
1262 |
assert 'Manage exception sources' in resp.text
|
|
1263 |
resp = resp.click('manage exceptions')
|
1264 |
1264 |
assert "To add new exceptions, you can upload a file or specify an address to a remote calendar." in resp
|
1265 |
1265 |
resp = resp.form.submit(status=200)
|
1266 |
1266 |
assert 'Please provide an ICS File or an URL.' in resp.text
|
1267 |
1267 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1268 |
1268 |
resp = resp.click('Settings')
|
1269 |
|
resp = resp.click('upload')
|
|
1269 |
resp = resp.click('manage exceptions')
|
1270 |
1270 |
resp.form['ics_file'] = Upload('exceptions.ics', b'invalid content', 'text/calendar')
|
1271 |
1271 |
resp = resp.form.submit(status=200)
|
1272 |
1272 |
assert 'File format is invalid' in resp.text
|
... | ... | |
1300 |
1300 |
END:VCALENDAR"""
|
1301 |
1301 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1302 |
1302 |
resp = resp.click('Settings')
|
1303 |
|
resp = resp.click('upload')
|
|
1303 |
resp = resp.click('manage exceptions')
|
1304 |
1304 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_exceptions, 'text/calendar')
|
1305 |
1305 |
resp = resp.form.submit(status=302)
|
1306 |
1306 |
assert TimePeriodException.objects.filter(desk=desk).count() == 1
|
... | ... | |
1326 |
1326 |
login(app)
|
1327 |
1327 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1328 |
1328 |
resp = resp.click('Settings')
|
1329 |
|
resp = resp.click('upload')
|
|
1329 |
resp = resp.click('manage exceptions')
|
1330 |
1330 |
ics_with_recurrent_exceptions = b"""BEGIN:VCALENDAR
|
1331 |
1331 |
VERSION:2.0
|
1332 |
1332 |
PRODID:-//foo.bar//EN
|
... | ... | |
1350 |
1350 |
login(app)
|
1351 |
1351 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1352 |
1352 |
resp = resp.click('Settings')
|
1353 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1353 |
assert 'Manage exception sources' not in resp.text
|
1354 |
1354 |
|
1355 |
1355 |
TimePeriod.objects.create(
|
1356 |
1356 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1358 |
1358 |
|
1359 |
1359 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1360 |
1360 |
resp = resp.click('Settings')
|
1361 |
|
resp = resp.click('upload')
|
|
1361 |
resp = resp.click('manage exceptions')
|
1362 |
1362 |
|
1363 |
1363 |
assert 'ics_file' in resp.form.fields
|
1364 |
1364 |
assert 'ics_url' in resp.form.fields
|
... | ... | |
1394 |
1394 |
login(app)
|
1395 |
1395 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1396 |
1396 |
resp = resp.click('Settings')
|
1397 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1397 |
assert 'Manage exception sources' not in resp.text
|
1398 |
1398 |
|
1399 |
1399 |
TimePeriod.objects.create(
|
1400 |
1400 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1402 |
1402 |
|
1403 |
1403 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1404 |
1404 |
resp = resp.click('Settings')
|
1405 |
|
resp = resp.click('upload')
|
|
1405 |
resp = resp.click('manage exceptions')
|
1406 |
1406 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1407 |
1407 |
mocked_response = mock.Mock()
|
1408 |
1408 |
mocked_response.text = """BEGIN:VCALENDAR
|
... | ... | |
1429 |
1429 |
login(app)
|
1430 |
1430 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1431 |
1431 |
resp = resp.click('Settings')
|
1432 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1432 |
assert 'Manage exception sources' not in resp.text
|
1433 |
1433 |
|
1434 |
1434 |
TimePeriod.objects.create(
|
1435 |
1435 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1437 |
1437 |
|
1438 |
1438 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1439 |
1439 |
resp = resp.click('Settings')
|
1440 |
|
resp = resp.click('upload')
|
|
1440 |
resp = resp.click('manage exceptions')
|
1441 |
1441 |
|
1442 |
1442 |
assert 'ics_file' in resp.form.fields
|
1443 |
1443 |
assert 'ics_url' in resp.form.fields
|
... | ... | |
1461 |
1461 |
login(app)
|
1462 |
1462 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1463 |
1463 |
resp = resp.click('Settings')
|
1464 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1464 |
assert 'Manage exception sources' not in resp.text
|
1465 |
1465 |
|
1466 |
1466 |
TimePeriod.objects.create(
|
1467 |
1467 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1469 |
1469 |
|
1470 |
1470 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1471 |
1471 |
resp = resp.click('Settings')
|
1472 |
|
resp = resp.click('upload')
|
|
1472 |
resp = resp.click('manage exceptions')
|
1473 |
1473 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1474 |
1474 |
mocked_response = mock.Mock()
|
1475 |
1475 |
mocked_response.status_code = 403
|
... | ... | |
1491 |
1491 |
login(app)
|
1492 |
1492 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1493 |
1493 |
resp = resp.click('Settings')
|
1494 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1494 |
assert 'Manage exception sources' not in resp.text
|
1495 |
1495 |
TimePeriod.objects.create(
|
1496 |
1496 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
1497 |
1497 |
)
|
1498 |
1498 |
|
1499 |
1499 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1500 |
1500 |
resp = resp.click('Settings')
|
1501 |
|
resp = resp.click('upload')
|
|
1501 |
resp = resp.click('manage exceptions')
|
1502 |
1502 |
resp.form['ics_url'] = 'https://example.com/foo.ics'
|
1503 |
1503 |
mocked_response = mock.Mock()
|
1504 |
1504 |
mocked_get.return_value = mocked_response
|
... | ... | |
1523 |
1523 |
# import a source
|
1524 |
1524 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1525 |
1525 |
resp = resp.click('Settings')
|
1526 |
|
resp = resp.click('upload')
|
|
1526 |
resp = resp.click('manage exceptions')
|
1527 |
1527 |
ics_with_recurrent_exceptions = b"""BEGIN:VCALENDAR
|
1528 |
1528 |
VERSION:2.0
|
1529 |
1529 |
PRODID:-//foo.bar//EN
|
... | ... | |
1543 |
1543 |
# import another one
|
1544 |
1544 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1545 |
1545 |
resp = resp.click('Settings')
|
1546 |
|
resp = resp.click('upload')
|
|
1546 |
resp = resp.click('manage exceptions')
|
1547 |
1547 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_recurrent_exceptions, 'text/calendar')
|
1548 |
1548 |
resp = resp.form.submit(status=302).follow()
|
1549 |
1549 |
assert TimePeriodException.objects.filter(desk=desk).count() == 4
|
... | ... | |
1553 |
1553 |
# delete the second one
|
1554 |
1554 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1555 |
1555 |
resp = resp.click('Settings')
|
1556 |
|
resp = resp.click('upload')
|
|
1556 |
resp = resp.click('manage exceptions')
|
1557 |
1557 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/delete' % source2.pk)
|
1558 |
1558 |
resp = resp.form.submit().follow()
|
1559 |
1559 |
assert TimePeriodException.objects.count() == 2
|
... | ... | |
1563 |
1563 |
# delete the first one
|
1564 |
1564 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1565 |
1565 |
resp = resp.click('Settings')
|
1566 |
|
resp = resp.click('upload')
|
|
1566 |
resp = resp.click('manage exceptions')
|
1567 |
1567 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/delete' % source1.pk)
|
1568 |
1568 |
resp = resp.form.submit().follow()
|
1569 |
1569 |
assert TimePeriodException.objects.count() == 0
|
... | ... | |
1593 |
1593 |
# import a source from a file
|
1594 |
1594 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1595 |
1595 |
resp = resp.click('Settings')
|
1596 |
|
resp = resp.click('upload')
|
|
1596 |
resp = resp.click('manage exceptions')
|
1597 |
1597 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_file_content, 'text/calendar')
|
1598 |
1598 |
resp = resp.form.submit(status=302).follow()
|
1599 |
1599 |
assert TimePeriodException.objects.filter(desk=desk).count() == 2
|
... | ... | |
1605 |
1605 |
# replace the source
|
1606 |
1606 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1607 |
1607 |
resp = resp.click('Settings')
|
1608 |
|
resp = resp.click('upload')
|
|
1608 |
resp = resp.click('manage exceptions')
|
1609 |
1609 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/replace' % source.pk)
|
1610 |
1610 |
resp.form['ics_newfile'] = Upload('exceptions.ics', ics_file_content, 'text/calendar')
|
1611 |
1611 |
resp = resp.form.submit().follow()
|
... | ... | |
1641 |
1641 |
# import a source from an url
|
1642 |
1642 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1643 |
1643 |
resp = resp.click('Settings')
|
1644 |
|
resp = resp.click('upload')
|
|
1644 |
resp = resp.click('manage exceptions')
|
1645 |
1645 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1646 |
1646 |
mocked_response = mock.Mock()
|
1647 |
1647 |
mocked_response.text = ics_url_content
|
... | ... | |
1655 |
1655 |
# refresh the source
|
1656 |
1656 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1657 |
1657 |
resp = resp.click('Settings')
|
1658 |
|
resp = resp.click('upload')
|
|
1658 |
resp = resp.click('manage exceptions')
|
1659 |
1659 |
mocked_response = mock.Mock()
|
1660 |
1660 |
mocked_response.text = ics_url_content
|
1661 |
1661 |
mocked_get.return_value = mocked_response
|
... | ... | |
1681 |
1681 |
login(app)
|
1682 |
1682 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1683 |
1683 |
resp = resp.click('Settings')
|
1684 |
|
resp = resp.click('upload')
|
|
1684 |
resp = resp.click('manage exceptions')
|
1685 |
1685 |
assert 'Holidays' in resp.text
|
1686 |
1686 |
assert 'disabled' not in resp.text
|
1687 |
1687 |
assert 'refresh' not in resp.text
|
... | ... | |
1689 |
1689 |
resp = resp.click('disable').follow()
|
1690 |
1690 |
assert not TimePeriodException.objects.exists()
|
1691 |
1691 |
|
1692 |
|
resp = resp.click('upload')
|
|
1692 |
resp = resp.click('manage exceptions')
|
1693 |
1693 |
assert 'Holidays' in resp.text
|
1694 |
1694 |
assert 'disabled' in resp.text
|
1695 |
1695 |
|
1696 |
1696 |
resp = resp.click('enable').follow()
|
1697 |
1697 |
assert TimePeriodException.objects.exists()
|
1698 |
1698 |
|
1699 |
|
resp = resp.click('upload')
|
|
1699 |
resp = resp.click('manage exceptions')
|
1700 |
1700 |
assert 'disabled' not in resp.text
|
1701 |
1701 |
|
1702 |
1702 |
|
... | ... | |
1712 |
1712 |
login(app)
|
1713 |
1713 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1714 |
1714 |
resp = resp.click('Settings')
|
1715 |
|
resp = resp.click('upload')
|
|
1715 |
resp = resp.click('manage exceptions')
|
1716 |
1716 |
assert 'test.ics' in resp.text
|
1717 |
1717 |
|
1718 |
1718 |
assert app.get('/manage/time-period-exceptions-source/%s/toggle' % source.pk, status=404)
|
1719 |
|
-
|