1224 |
1224 |
login(app)
|
1225 |
1225 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1226 |
1226 |
resp = resp.click('Settings')
|
1227 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1227 |
assert 'Manage exception sources' not in resp.text
|
1228 |
1228 |
|
1229 |
1229 |
TimePeriod.objects.create(
|
1230 |
1230 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1232 |
1232 |
|
1233 |
1233 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1234 |
1234 |
resp = resp.click('Settings')
|
1235 |
|
assert 'Import exceptions from .ics' in resp.text
|
1236 |
|
resp = resp.click('upload')
|
|
1235 |
assert 'Manage exception sources' in resp.text
|
|
1236 |
resp = resp.click('manage exceptions')
|
1237 |
1237 |
assert "To add new exceptions, you can upload a file or specify an address to a remote calendar." in resp
|
1238 |
1238 |
resp = resp.form.submit(status=200)
|
1239 |
1239 |
assert 'Please provide an ICS File or an URL.' in resp.text
|
1240 |
1240 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1241 |
1241 |
resp = resp.click('Settings')
|
1242 |
|
resp = resp.click('upload')
|
|
1242 |
resp = resp.click('manage exceptions')
|
1243 |
1243 |
resp.form['ics_file'] = Upload('exceptions.ics', b'invalid content', 'text/calendar')
|
1244 |
1244 |
resp = resp.form.submit(status=200)
|
1245 |
1245 |
assert 'File format is invalid' in resp.text
|
... | ... | |
1273 |
1273 |
END:VCALENDAR"""
|
1274 |
1274 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1275 |
1275 |
resp = resp.click('Settings')
|
1276 |
|
resp = resp.click('upload')
|
|
1276 |
resp = resp.click('manage exceptions')
|
1277 |
1277 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_exceptions, 'text/calendar')
|
1278 |
1278 |
resp = resp.form.submit(status=302)
|
1279 |
1279 |
assert TimePeriodException.objects.filter(desk=desk).count() == 1
|
... | ... | |
1299 |
1299 |
login(app)
|
1300 |
1300 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1301 |
1301 |
resp = resp.click('Settings')
|
1302 |
|
resp = resp.click('upload')
|
|
1302 |
resp = resp.click('manage exceptions')
|
1303 |
1303 |
ics_with_recurrent_exceptions = b"""BEGIN:VCALENDAR
|
1304 |
1304 |
VERSION:2.0
|
1305 |
1305 |
PRODID:-//foo.bar//EN
|
... | ... | |
1323 |
1323 |
login(app)
|
1324 |
1324 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1325 |
1325 |
resp = resp.click('Settings')
|
1326 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1326 |
assert 'Manage exception sources' not in resp.text
|
1327 |
1327 |
|
1328 |
1328 |
TimePeriod.objects.create(
|
1329 |
1329 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1331 |
1331 |
|
1332 |
1332 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1333 |
1333 |
resp = resp.click('Settings')
|
1334 |
|
resp = resp.click('upload')
|
|
1334 |
resp = resp.click('manage exceptions')
|
1335 |
1335 |
|
1336 |
1336 |
assert 'ics_file' in resp.form.fields
|
1337 |
1337 |
assert 'ics_url' in resp.form.fields
|
... | ... | |
1367 |
1367 |
login(app)
|
1368 |
1368 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1369 |
1369 |
resp = resp.click('Settings')
|
1370 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1370 |
assert 'Manage exception sources' not in resp.text
|
1371 |
1371 |
|
1372 |
1372 |
TimePeriod.objects.create(
|
1373 |
1373 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1375 |
1375 |
|
1376 |
1376 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1377 |
1377 |
resp = resp.click('Settings')
|
1378 |
|
resp = resp.click('upload')
|
|
1378 |
resp = resp.click('manage exceptions')
|
1379 |
1379 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1380 |
1380 |
mocked_response = mock.Mock()
|
1381 |
1381 |
mocked_response.text = """BEGIN:VCALENDAR
|
... | ... | |
1402 |
1402 |
login(app)
|
1403 |
1403 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1404 |
1404 |
resp = resp.click('Settings')
|
1405 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1405 |
assert 'Manage exception sources' not in resp.text
|
1406 |
1406 |
|
1407 |
1407 |
TimePeriod.objects.create(
|
1408 |
1408 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1410 |
1410 |
|
1411 |
1411 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1412 |
1412 |
resp = resp.click('Settings')
|
1413 |
|
resp = resp.click('upload')
|
|
1413 |
resp = resp.click('manage exceptions')
|
1414 |
1414 |
|
1415 |
1415 |
assert 'ics_file' in resp.form.fields
|
1416 |
1416 |
assert 'ics_url' in resp.form.fields
|
... | ... | |
1434 |
1434 |
login(app)
|
1435 |
1435 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1436 |
1436 |
resp = resp.click('Settings')
|
1437 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1437 |
assert 'Manage exception sources' not in resp.text
|
1438 |
1438 |
|
1439 |
1439 |
TimePeriod.objects.create(
|
1440 |
1440 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
... | ... | |
1442 |
1442 |
|
1443 |
1443 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1444 |
1444 |
resp = resp.click('Settings')
|
1445 |
|
resp = resp.click('upload')
|
|
1445 |
resp = resp.click('manage exceptions')
|
1446 |
1446 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1447 |
1447 |
mocked_response = mock.Mock()
|
1448 |
1448 |
mocked_response.status_code = 403
|
... | ... | |
1464 |
1464 |
login(app)
|
1465 |
1465 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1466 |
1466 |
resp = resp.click('Settings')
|
1467 |
|
assert 'Import exceptions from .ics' not in resp.text
|
|
1467 |
assert 'Manage exception sources' not in resp.text
|
1468 |
1468 |
TimePeriod.objects.create(
|
1469 |
1469 |
weekday=1, desk=desk, start_time=datetime.time(10, 0), end_time=datetime.time(12, 0)
|
1470 |
1470 |
)
|
1471 |
1471 |
|
1472 |
1472 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1473 |
1473 |
resp = resp.click('Settings')
|
1474 |
|
resp = resp.click('upload')
|
|
1474 |
resp = resp.click('manage exceptions')
|
1475 |
1475 |
resp.form['ics_url'] = 'https://example.com/foo.ics'
|
1476 |
1476 |
mocked_response = mock.Mock()
|
1477 |
1477 |
mocked_get.return_value = mocked_response
|
... | ... | |
1496 |
1496 |
# import a source
|
1497 |
1497 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1498 |
1498 |
resp = resp.click('Settings')
|
1499 |
|
resp = resp.click('upload')
|
|
1499 |
resp = resp.click('manage exceptions')
|
1500 |
1500 |
ics_with_recurrent_exceptions = b"""BEGIN:VCALENDAR
|
1501 |
1501 |
VERSION:2.0
|
1502 |
1502 |
PRODID:-//foo.bar//EN
|
... | ... | |
1516 |
1516 |
# import another one
|
1517 |
1517 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1518 |
1518 |
resp = resp.click('Settings')
|
1519 |
|
resp = resp.click('upload')
|
|
1519 |
resp = resp.click('manage exceptions')
|
1520 |
1520 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_with_recurrent_exceptions, 'text/calendar')
|
1521 |
1521 |
resp = resp.form.submit(status=302).follow()
|
1522 |
1522 |
assert TimePeriodException.objects.filter(desk=desk).count() == 4
|
... | ... | |
1526 |
1526 |
# delete the second one
|
1527 |
1527 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1528 |
1528 |
resp = resp.click('Settings')
|
1529 |
|
resp = resp.click('upload')
|
|
1529 |
resp = resp.click('manage exceptions')
|
1530 |
1530 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/delete' % source2.pk)
|
1531 |
1531 |
resp = resp.form.submit().follow()
|
1532 |
1532 |
assert TimePeriodException.objects.count() == 2
|
... | ... | |
1536 |
1536 |
# delete the first one
|
1537 |
1537 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1538 |
1538 |
resp = resp.click('Settings')
|
1539 |
|
resp = resp.click('upload')
|
|
1539 |
resp = resp.click('manage exceptions')
|
1540 |
1540 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/delete' % source1.pk)
|
1541 |
1541 |
resp = resp.form.submit().follow()
|
1542 |
1542 |
assert TimePeriodException.objects.count() == 0
|
... | ... | |
1566 |
1566 |
# import a source from a file
|
1567 |
1567 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1568 |
1568 |
resp = resp.click('Settings')
|
1569 |
|
resp = resp.click('upload')
|
|
1569 |
resp = resp.click('manage exceptions')
|
1570 |
1570 |
resp.form['ics_file'] = Upload('exceptions.ics', ics_file_content, 'text/calendar')
|
1571 |
1571 |
resp = resp.form.submit(status=302).follow()
|
1572 |
1572 |
assert TimePeriodException.objects.filter(desk=desk).count() == 2
|
... | ... | |
1578 |
1578 |
# replace the source
|
1579 |
1579 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1580 |
1580 |
resp = resp.click('Settings')
|
1581 |
|
resp = resp.click('upload')
|
|
1581 |
resp = resp.click('manage exceptions')
|
1582 |
1582 |
resp = resp.click(href='/manage/time-period-exceptions-source/%d/replace' % source.pk)
|
1583 |
1583 |
resp.form['ics_newfile'] = Upload('exceptions.ics', ics_file_content, 'text/calendar')
|
1584 |
1584 |
resp = resp.form.submit().follow()
|
... | ... | |
1614 |
1614 |
# import a source from an url
|
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 |
resp.form['ics_url'] = 'http://example.com/foo.ics'
|
1619 |
1619 |
mocked_response = mock.Mock()
|
1620 |
1620 |
mocked_response.text = ics_url_content
|
... | ... | |
1628 |
1628 |
# refresh the source
|
1629 |
1629 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1630 |
1630 |
resp = resp.click('Settings')
|
1631 |
|
resp = resp.click('upload')
|
|
1631 |
resp = resp.click('manage exceptions')
|
1632 |
1632 |
mocked_response = mock.Mock()
|
1633 |
1633 |
mocked_response.text = ics_url_content
|
1634 |
1634 |
mocked_get.return_value = mocked_response
|
... | ... | |
1654 |
1654 |
login(app)
|
1655 |
1655 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1656 |
1656 |
resp = resp.click('Settings')
|
1657 |
|
resp = resp.click('upload')
|
|
1657 |
resp = resp.click('manage exceptions')
|
1658 |
1658 |
assert 'Holidays' in resp.text
|
1659 |
1659 |
assert 'disabled' not in resp.text
|
1660 |
1660 |
assert 'refresh' not in resp.text
|
... | ... | |
1662 |
1662 |
resp = resp.click('disable').follow()
|
1663 |
1663 |
assert not TimePeriodException.objects.exists()
|
1664 |
1664 |
|
1665 |
|
resp = resp.click('upload')
|
|
1665 |
resp = resp.click('manage exceptions')
|
1666 |
1666 |
assert 'Holidays' in resp.text
|
1667 |
1667 |
assert 'disabled' in resp.text
|
1668 |
1668 |
|
1669 |
1669 |
resp = resp.click('enable').follow()
|
1670 |
1670 |
assert TimePeriodException.objects.exists()
|
1671 |
1671 |
|
1672 |
|
resp = resp.click('upload')
|
|
1672 |
resp = resp.click('manage exceptions')
|
1673 |
1673 |
assert 'disabled' not in resp.text
|
1674 |
1674 |
|
1675 |
1675 |
def test_meetings_agenda_time_period_exception_source_try_disable_ics(app, admin_user):
|
... | ... | |
1684 |
1684 |
login(app)
|
1685 |
1685 |
resp = app.get('/manage/agendas/%d/' % agenda.pk).follow()
|
1686 |
1686 |
resp = resp.click('Settings')
|
1687 |
|
resp = resp.click('upload')
|
|
1687 |
resp = resp.click('manage exceptions')
|
1688 |
1688 |
assert 'test.ics' in resp.text
|
1689 |
1689 |
|
1690 |
1690 |
assert app.get('/manage/time-period-exceptions-source/%s/toggle' % source.pk, status=404)
|
1691 |
|
-
|