def test_view_user_sessions(gazette_app): admin = Client(gazette_app) with freeze_time("2016-06-06 06:06"): login_admin(admin) client_1 = Client(gazette_app) with freeze_time("2017-07-07 07:07"): login_editor_1(client_1) client_2 = Client(gazette_app) with freeze_time("2018-08-08 08:08"): login_editor_1(client_2) client_1.get('/dashboard') client_2.get('/dashboard') manage = admin.get('/users/sessions') assert '([email protected])' in manage assert '([email protected])' in manage assert '2016-06-06T06:06:00' in manage assert '2017-07-07T07:07:00' in manage assert '2018-08-08T08:08:00' in manage manage.click('Sitzungen beenden', href='editor1', index=0).form.submit() manage = admin.get('/users/sessions') assert '([email protected])' in manage assert '([email protected])' not in manage assert '2016-06-06T06:06:00' in manage assert '2017-07-07T07:07:00' not in manage assert '2018-08-08T08:08:00' not in manage client_1.get('/dashboard', status=403) client_2.get('/dashboard', status=403)
def test_view_issues_export(gazette_app): client = Client(gazette_app) client.get('/issues/export', status=403) login_editor_1(client) client.get('/issues/export', status=403) login_publisher(client) response = client.get('/issues/export') book = open_workbook(file_contents=response.body) assert book.nsheets == 1 sheet = book.sheets()[0] assert sheet.ncols == 4 assert sheet.nrows == 15 def as_date(cell): return datetime( *xldate_as_tuple(cell.value, book.datemode) ).date().isoformat() def as_datetime(cell): return datetime( *xldate_as_tuple(cell.value, book.datemode) ).isoformat() assert sheet.cell(0, 0).value == 'Jahr' assert sheet.cell(0, 1).value == 'Nummer' assert sheet.cell(0, 2).value == 'Datum' assert sheet.cell(0, 3).value == 'Eingabeschluss' assert int(sheet.cell(1, 0).value) == 2017 assert int(sheet.cell(1, 1).value) == 40 assert as_date(sheet.cell(1, 2)) == '2017-10-06' assert as_datetime(sheet.cell(1, 3)) == '2017-10-04T14:00:00' assert int(sheet.cell(5, 0).value) == 2017 assert int(sheet.cell(5, 1).value) == 44 assert as_date(sheet.cell(5, 2)) == '2017-11-03' assert as_datetime(sheet.cell(5, 3)) == '2017-11-01T13:00:00' assert int(sheet.cell(13, 0).value) == 2017 assert int(sheet.cell(13, 1).value) == 52 assert as_date(sheet.cell(13, 2)) == '2017-12-29' assert as_datetime(sheet.cell(13, 3)) == '2017-12-27T13:00:00' assert int(sheet.cell(14, 0).value) == 2018 assert int(sheet.cell(14, 1).value) == 1 assert as_date(sheet.cell(14, 2)) == '2018-01-05' assert as_datetime(sheet.cell(14, 3)) == '2018-01-03T13:00:00'
def test_view_organizations_permissions(gazette_app): client = Client(gazette_app) login_publisher(client) manage = client.get('/organizations').click('Neu') manage.form['title'] = 'XY' manage = manage.form.submit().maybe_follow() edit_link = manage.click('Bearbeiten', index=0).request.url delete_link = manage.click('Löschen', index=0).request.url login_editor_1(client) client.get('/organizations', status=403) client.get(edit_link, status=403) client.get(delete_link, status=403)
def test_view_principal(gazette_app): client = Client(gazette_app) assert 'Startseite' in client.get('/').maybe_follow() assert '<h2>Anmelden</h2>' in client.get('/').maybe_follow() login_admin(client) assert '/notices' in client.get('/').maybe_follow().request.url login_publisher(client) assert '/notices' in client.get('/').maybe_follow().request.url login_editor_1(client) assert '/dashboard' in client.get('/').maybe_follow().request.url
def test_view_dashboard_publishing_disabled(gazette_app): editor = Client(gazette_app) login_editor_1(editor) manage = editor.get('/').maybe_follow() assert "notices/accepted" not in manage assert "notices/published" in manage principal = gazette_app.principal principal.publishing = False gazette_app.cache.set('principal', principal) manage = editor.get('/').maybe_follow() assert "notices/accepted" in manage assert "notices/published" not in manage
def test_view_issues_permissions(gazette_app): with freeze_time("2017-10-20 12:00"): client = Client(gazette_app) login_publisher(client) manage = client.get('/issues').click('Neu') manage.form['number'] = '1' manage.form['date_'] = '2017-01-02' manage.form['deadline'] = '2017-01-01T12:00' manage = manage.form.submit().maybe_follow() edit_link = manage.click('Bearbeiten', index=0).request.url delete_link = manage.click('Löschen', index=0).request.url login_editor_1(client) client.get('/issues', status=403) client.get(edit_link, status=403) client.get(delete_link, status=403)
def test_view_user_delete(gazette_app): admin = Client(gazette_app) login_admin(admin) client_1 = Client(gazette_app) login_editor_1(client_1) client_1.get('/dashboard') client_2 = Client(gazette_app) login_editor_1(client_2) client_2.get('/dashboard') manage = admin.get('/users').click("Löschen", href='editor1') manage = manage.form.submit().maybe_follow() assert "Benutzer gelöscht." in manage client_1.get('/dashboard', status=403) client_2.get('/dashboard', status=403)
def test_view_users_permissions(gazette_app): client = Client(gazette_app) login_admin(client) manage = client.get('/users') assert "<h3>Redaktoren</h3>" in manage assert "<h3>Herausgeber</h3>" in manage edit_editor = manage.click("Bearbeiten", href='editor1').request.url delete_editor = manage.click("Löschen", href='editor1').request.url edit_publisher = manage.click("Bearbeiten", href='publisher').request.url delete_publisher = manage.click("Löschen", href='publisher').request.url login_publisher(client) manage = client.get('/users') assert "<h3>Redaktoren</h3>" in manage assert "<h3>Herausgeber</h3>" not in manage assert manage.click("Bearbeiten", href='editor1').request.url == \ edit_editor assert manage.click("Löschen", href='editor1').request.url == delete_editor client.get(edit_publisher, status=403) client.get(delete_publisher, status=403) login_editor_1(client) client.get('/users', status=403) client.get(edit_editor, status=403) client.get(edit_publisher, status=403) client.get(delete_editor, status=403) client.get(delete_publisher, status=403) login_editor_2(client) client.get('/users', status=403) client.get(edit_editor, status=403) client.get(edit_publisher, status=403) client.get(delete_editor, status=403) client.get(delete_publisher, status=403) login_editor_3(client) client.get('/users', status=403) client.get(edit_editor, status=403) client.get(edit_publisher, status=403) client.get(delete_editor, status=403) client.get(delete_publisher, status=403)
def test_view_categories_export(gazette_app): client = Client(gazette_app) client.get('/categories/export', status=403) login_editor_1(client) client.get('/categories/export', status=403) login_publisher(client) response = client.get('/categories/export') book = open_workbook(file_contents=response.body) assert book.nsheets == 1 sheet = book.sheets()[0] assert sheet.ncols == 4 assert sheet.nrows == 6 assert sheet.cell(0, 0).value == 'ID' assert sheet.cell(0, 1).value == 'Name' assert sheet.cell(0, 2).value == 'Titel' assert sheet.cell(0, 3).value == 'Aktiv' assert sheet.cell(1, 1).value == '13' assert sheet.cell(1, 2).value == 'Commercial Register' assert sheet.cell(1, 3).value == 1 assert sheet.cell(2, 1).value == '10' assert sheet.cell(2, 2).value == 'Complaints' assert sheet.cell(2, 3).value == 0 assert sheet.cell(3, 1).value == '11' assert sheet.cell(3, 2).value == 'Education' assert sheet.cell(3, 3).value == 1 assert sheet.cell(4, 1).value == '14' assert sheet.cell(4, 2).value == 'Elections' assert sheet.cell(4, 3).value == 1 assert sheet.cell(5, 1).value == '12' assert sheet.cell(5, 2).value == 'Submissions' assert sheet.cell(5, 3).value == 1
def test_view_user_modify(gazette_app): admin = Client(gazette_app) login_admin(admin) client_1 = Client(gazette_app) login_editor_1(client_1) client_1.get('/dashboard') client_2 = Client(gazette_app) login_editor_1(client_2) client_2.get('/dashboard') manage = admin.get('/users').click("Bearbeiten", href='editor1') manage.form['role'] = 'member' manage.form['name'] = "Hans" manage = manage.form.submit().maybe_follow() assert "Benutzer geändert." in manage client_1.get('/dashboard', status=403) client_2.get('/dashboard', status=403)
def test_view_groups_permissions(gazette_app): client = Client(gazette_app) login_admin(client) manage = client.get('/groups').click("Neu") manage.form['name'] = 'XY' manage = manage.form.submit().maybe_follow() edit_link = manage.click('Bearbeiten', index=0).request.url delete_link = manage.click('Löschen', index=0).request.url login_publisher(client) manage = client.get('/groups').click("Neu") manage.form['name'] = 'YZ' manage = manage.form.submit().maybe_follow() assert manage.click('Bearbeiten', index=0).request.url == edit_link assert manage.click('Löschen', index=0).request.url == delete_link login_editor_1(client) client.get('/groups', status=403) client.get(edit_link, status=403) client.get(delete_link, status=403)
def test_view_organizations_export(gazette_app): client = Client(gazette_app) client.get('/organizations/export', status=403) login_editor_1(client) client.get('/organizations/export', status=403) login_publisher(client) response = client.get('/organizations/export') book = open_workbook(file_contents=response.body) assert book.nsheets == 1 sheet = book.sheets()[0] assert sheet.ncols == 6 assert sheet.nrows == 9 assert sheet.cell(0, 0).value == 'ID' assert sheet.cell(0, 1).value == 'Name' assert sheet.cell(0, 2).value == 'Titel' assert sheet.cell(0, 3).value == 'Aktiv' assert sheet.cell(0, 4).value == 'Externe ID' assert sheet.cell(0, 5).value == 'Übergeordnete Organisation' assert sheet.cell(1, 1).value == '100' assert sheet.cell(1, 2).value == 'State Chancellery' assert sheet.cell(1, 3).value == 1 assert sheet.cell(1, 4).value == '' assert sheet.cell(1, 5).value == '' assert sheet.cell(2, 1).value == '200' assert sheet.cell(2, 2).value == 'Civic Community' assert sheet.cell(2, 3).value == 1 assert sheet.cell(2, 4).value == '' assert sheet.cell(2, 5).value == '' assert sheet.cell(3, 1).value == '300' assert sheet.cell(3, 2).value == 'Municipality' assert sheet.cell(3, 3).value == 1 assert sheet.cell(3, 4).value == '' assert sheet.cell(3, 5).value == '' assert sheet.cell(4, 1).value == '400' assert sheet.cell(4, 2).value == 'Churches' assert sheet.cell(4, 3).value == 1 assert sheet.cell(4, 4).value == '' assert sheet.cell(4, 5).value == '' assert sheet.cell(5, 1).value == '410' assert sheet.cell(5, 2).value == 'Evangelical Reformed Parish' assert sheet.cell(5, 3).value == 1 assert sheet.cell(5, 4).value == '' assert int(sheet.cell(5, 5).value) == int(sheet.cell(4, 0).value) assert sheet.cell(6, 1).value == '420' assert sheet.cell(6, 2).value == 'Sikh Community' assert sheet.cell(6, 3).value == 0 assert sheet.cell(6, 4).value == '4' assert int(sheet.cell(6, 5).value) == int(sheet.cell(4, 0).value) assert sheet.cell(7, 1).value == '430' assert sheet.cell(7, 2).value == 'Catholic Parish' assert sheet.cell(7, 3).value == 1 assert sheet.cell(7, 4).value == '' assert int(sheet.cell(7, 5).value) == int(sheet.cell(4, 0).value) assert sheet.cell(8, 1).value == '500' assert sheet.cell(8, 2).value == 'Corporation' assert sheet.cell(8, 3).value == 1 assert sheet.cell(8, 4).value == '' assert sheet.cell(8, 5).value == ''
def test_view_dashboard(gazette_app): editor_1 = Client(gazette_app) login_editor_1(editor_1) editor_2 = Client(gazette_app) login_editor_2(editor_2) editor_3 = Client(gazette_app) login_editor_3(editor_3) publisher = Client(gazette_app) login_publisher(publisher) # Group: Testgroup (editor_1 & editor_2) with freeze_time("2017-10-20 12:00"): deadline = ("<span>Nächster Eingabeschluss</span>: " "<strong>Mittwoch 25.10.2017 14:00</strong>") manage = editor_1.get('/').maybe_follow() assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage assert deadline in manage # new notice manage = manage.click("Neu") assert deadline in manage manage.form['title'] = "Erneuerungswahlen" manage.form['organization'] = '100' manage.form['category'] = '11' manage.form['issues'] = ['2017-44', '2017-45'] manage.form['text'] = "1. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() manage = editor_1.get('/').maybe_follow() assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" in manage assert "<h3>Eingereicht</h3>" not in manage manage = editor_2.get('/').maybe_follow() # same group assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" in manage assert "<h3>Eingereicht</h3>" not in manage manage = editor_3.get('/').maybe_follow() # other group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage with freeze_time("2017-11-01 11:00"): manage = editor_1.get('/').maybe_follow() assert ("Sie haben Meldungen in Arbeit, für welche der " "Eingabeschluss bald erreicht ist.") in manage with freeze_time("2017-11-02 12:00"): deadline = ("<span>Nächster Eingabeschluss</span>: " "<strong>Mittwoch 08.11.2017 13:00</strong>") manage = editor_1.get('/').maybe_follow() assert ("Sie haben Meldungen in Arbeit mit vergangenen Ausgaben." ) in manage assert ("Sie haben Meldungenen in Arbeit, für welche der " "Eingabeschluss bald erreicht ist.") not in manage # edit notice manage = editor_1.get('/notice/erneuerungswahlen').click("Bearbeiten") assert deadline in manage manage.form['issues'] = ['2017-45'] manage.form.submit() # submit notice manage = editor_1.get('/').maybe_follow() manage.click("Erneuerungswahlen").click("Einreichen").form.submit() manage = editor_1.get('/').maybe_follow() assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" in manage manage = editor_2.get('/').maybe_follow() # same group assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" in manage manage = editor_3.get('/').maybe_follow() # other group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage # reject notice manage = publisher.get('/').maybe_follow().click("Erneuerungswahlen") manage = manage.click("Zurückweisen") manage.form['comment'] = 'comment' manage = manage.form.submit() manage = editor_1.get('/').maybe_follow() assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage assert "Sie haben zurückgewiesene Meldungen." in manage manage = editor_2.get('/').maybe_follow() # same group assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage assert "Sie haben zurückgewiesene Meldungen." in manage manage = editor_3.get('/').maybe_follow() # other group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage # submit & accept notice manage = editor_1.get('/').maybe_follow().click("Erneuerungswahlen") manage.click("Einreichen").form.submit() manage = publisher.get('/').maybe_follow().click("Erneuerungswahlen") manage.click("Annehmen").form.submit() manage = editor_1.get('/').maybe_follow() assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage assert "Sie haben zurückgewiesene Meldungen." not in manage manage = editor_2.get('/').maybe_follow() # same group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage assert "Sie haben zurückgewiesene Meldungen." not in manage manage = editor_3.get('/').maybe_follow() # other group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage # Group: None (editor_3) with freeze_time("2017-10-20 12:00"): manage = editor_3.get('/').maybe_follow() assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage # new notice manage = manage.click("Neu") manage.form['title'] = "Kantonsratswahlen" manage.form['organization'] = '100' manage.form['category'] = '11' manage.form['issues'] = ['2017-44', '2017-45'] manage.form['text'] = "1. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() manage = editor_1.get('/').maybe_follow() # other group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage manage = editor_2.get('/').maybe_follow() # other group assert "Keine Meldungen." in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" not in manage assert "<h3>Eingereicht</h3>" not in manage manage = editor_3.get('/').maybe_follow() assert "Keine Meldungen." not in manage assert "<h3>Zurückgewiesen</h3>" not in manage assert "<h3>in Arbeit</h3>" in manage assert "<h3>Eingereicht</h3>" not in manage
def test_view_notices(gazette_app): with freeze_time("2017-11-01 11:00"): publisher = Client(gazette_app) login_publisher(publisher) editor_1 = Client(gazette_app) login_editor_1(editor_1) editor_2 = Client(gazette_app) login_editor_2(editor_2) editor_3 = Client(gazette_app) login_editor_3(editor_3) for user in (publisher, editor_1, editor_2, editor_3): for state in ('drafted', 'submitted', 'rejected', 'accepted', 'published'): assert "Keine Meldungen" in user.get('/notices/' + state) # new notices manage = editor_1.get('/notices/drafted/new-notice') manage.form['title'] = "Erneuerungswahlen" manage.form['organization'] = '200' manage.form['category'] = '11' manage.form['issues'] = ['2017-44', '2017-45'] manage.form['text'] = "1. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() manage = editor_3.get('/notices/drafted/new-notice') manage.form['title'] = "Kantonsratswahlen" manage.form['organization'] = '200' manage.form['category'] = '11' manage.form['issues'] = ['2017-44', '2017-45'] manage.form['text'] = "1. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() for user in (publisher, editor_1, editor_2, editor_3): for state in ('submitted', 'rejected', 'accepted', 'published'): assert "Keine Meldungen" in user.get('/notices/' + state) assert "Erneuerungswahlen" in publisher.get('/notices/drafted') assert "Erneuerungswahlen" in editor_1.get('/notices/drafted') assert "Erneuerungswahlen" in editor_2.get('/notices/drafted') assert "Erneuerungswahlen" not in editor_3.get('/notices/drafted') assert "Kantonsratswahlen" in publisher.get('/notices/drafted') assert "Kantonsratswahlen" not in editor_1.get('/notices/drafted') assert "Kantonsratswahlen" not in editor_1.get('/notices/drafted') assert "Kantonsratswahlen" in editor_3.get('/notices/drafted') # submit notices editor_1.get('/notice/erneuerungswahlen/submit').form.submit() editor_3.get('/notice/kantonsratswahlen/submit').form.submit() for user in (publisher, editor_1, editor_2, editor_3): for state in ('drafted', 'rejected', 'accepted', 'published'): assert "Keine Meldungen" in user.get('/notices/' + state) assert "Erneuerungswahlen" in publisher.get('/notices/submitted') assert "Erneuerungswahlen" in editor_1.get('/notices/submitted') assert "Erneuerungswahlen" in editor_2.get('/notices/submitted') assert "Erneuerungswahlen" not in editor_3.get('/notices/submitted') assert "Kantonsratswahlen" in publisher.get('/notices/submitted') assert "Kantonsratswahlen" not in editor_1.get('/notices/submitted') assert "Kantonsratswahlen" not in editor_2.get('/notices/submitted') assert "Kantonsratswahlen" in editor_3.get('/notices/submitted') # reject notices manage = publisher.get('/notice/erneuerungswahlen/reject') manage.form['comment'] = 'comment' manage.form.submit() manage = publisher.get('/notice/kantonsratswahlen/reject') manage.form['comment'] = 'comment' manage.form.submit() for user in (publisher, editor_1, editor_2, editor_3): for state in ('drafted', 'submitted', 'accepted', 'published'): assert "Keine Meldungen" in user.get('/notices/' + state) assert "Erneuerungswahlen" in publisher.get('/notices/rejected') assert "Erneuerungswahlen" in editor_1.get('/notices/rejected') assert "Erneuerungswahlen" in editor_2.get('/notices/rejected') assert "Erneuerungswahlen" not in editor_3.get('/notices/rejected') assert "Kantonsratswahlen" in publisher.get('/notices/rejected') assert "Kantonsratswahlen" not in editor_1.get('/notices/rejected') assert "Kantonsratswahlen" not in editor_2.get('/notices/rejected') assert "Kantonsratswahlen" in editor_3.get('/notices/rejected') # submit & accept notices editor_1.get('/notice/erneuerungswahlen/submit').form.submit() publisher.get('/notice/erneuerungswahlen/accept').form.submit() editor_3.get('/notice/kantonsratswahlen/submit').form.submit() publisher.get('/notice/kantonsratswahlen/accept').form.submit() for user in (publisher, editor_1, editor_2, editor_3): for state in ('drafted', 'submitted', 'rejected', 'published'): assert "Keine Meldungen" in user.get('/notices/' + state) assert "Erneuerungswahlen" in publisher.get('/notices/accepted') assert "Erneuerungswahlen" in editor_1.get('/notices/accepted') assert "Erneuerungswahlen" in editor_2.get('/notices/accepted') assert "Erneuerungswahlen" not in editor_3.get('/notices/accepted') assert "Kantonsratswahlen" in publisher.get('/notices/accepted') assert "Kantonsratswahlen" not in editor_1.get('/notices/accepted') assert "Kantonsratswahlen" not in editor_2.get('/notices/accepted') assert "Kantonsratswahlen" in editor_3.get('/notices/accepted') # publish notices assert "Erneuerungswahlen" in publisher.get('/notices/accepted') assert "Erneuerungswahlen" in editor_1.get('/notices/accepted') assert "Erneuerungswahlen" in editor_2.get('/notices/accepted') assert "Erneuerungswahlen" not in editor_3.get('/notices/accepted') assert "Kantonsratswahlen" in publisher.get('/notices/accepted') assert "Kantonsratswahlen" not in editor_1.get('/notices/accepted') assert "Kantonsratswahlen" not in editor_2.get('/notices/accepted') assert "Kantonsratswahlen" in editor_3.get('/notices/accepted')
def test_view_notices_filter(gazette_app): with freeze_time("2017-11-01 11:00"): client = Client(gazette_app) login_editor_1(client) manage = client.get('/notices/drafted/new-notice') manage.form['title'] = "Erneuerungswahlen" manage.form['organization'] = '100' manage.form['category'] = '11' manage.form['issues'] = ['2017-44', '2017-45'] manage.form['text'] = "1. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() client.get('/notice/erneuerungswahlen/submit').form.submit() login_editor_2(client) manage = client.get('/notices/drafted/new-notice') manage.form['title'] = "Kantonsratswahlen" manage.form['organization'] = '200' manage.form['category'] = '12' manage.form['issues'] = ['2017-45', '2017-46'] manage.form['text'] = "9. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() client.get('/notice/kantonsratswahlen/submit').form.submit() login_publisher(client) manage = client.get('/notices/drafted/new-notice') manage.form['title'] = "Regierungsratswahlen" manage.form['organization'] = '300' manage.form['category'] = '13' manage.form['issues'] = ['2017-47'] manage.form['text'] = "10. Oktober 2017" manage.form['author_place'] = 'Govikon' manage.form['author_name'] = 'State Chancellerist' manage.form['author_date'] = '2019-01-01' manage.form.submit() client.get('/notice/regierungsratswahlen/submit').form.submit() manage = client.get('/notice/kantonsratswahlen/edit') manage.form['text'] = "10. Oktober 2017" manage.form.submit() manage = client.get('/notices/submitted') assert "Erneuerungswahlen" in manage assert "Kantonsratswahlen" in manage assert "Regierungsratswahlen" in manage assert '<option value="2017-11-03">2017-44</option>' in manage assert '<option value="2017-11-10">2017-45</option>' in manage assert '<option value="2017-11-17">2017-46</option>' in manage assert '<option value="2017-11-24">2017-47</option>' in manage assert '<option value="2017-12-01">2017-48</option>' not in manage assert '<option value="100">State Chancellery</option>' in manage assert '<option value="200">Civic Community</option>' in manage assert '<option value="300">Municipality</option>' in manage assert '<option value="500">Corporation</option>' not in manage assert '<option value="11">Education</option>' in manage assert '<option value="12">Submissions</option>' in manage assert '<option value="13">Commercial Register</option>' in manage assert '<option value="14">Elections</option>' not in manage manage.form['term'] = 'neuerun' manage = manage.form.submit().maybe_follow() assert "Erneuerungswahlen" in manage assert "Kantonsratswahlen" not in manage assert "Regierungsratswahlen" not in manage manage = client.get('/notices/submitted') manage.form['term'] = '10. Oktober' manage = manage.form.submit().maybe_follow() assert "Erneuerungswahlen" not in manage assert "Kantonsratswahlen" in manage assert "Regierungsratswahlen" in manage manage = client.get('/notices/submitted') manage.form['term'] = '10. Oktober' manage.form['categories'] = '12' manage = manage.form.submit().maybe_follow() assert "Erneuerungswahlen" not in manage assert "Kantonsratswahlen" in manage assert "Regierungsratswahlen" not in manage manage = client.get('/notices/submitted') manage.form['term'] = '10. Oktober' manage.form['organizations'] = '200' manage = manage.form.submit().maybe_follow() assert "Erneuerungswahlen" not in manage assert "Kantonsratswahlen" in manage assert "Regierungsratswahlen" not in manage manage = client.get('/notices/submitted') manage.form['term'] = '10. Oktober' manage.form['from_date'] = '2017-11-17' manage.form['to_date'] = '2017-11-17' manage = manage.form.submit().maybe_follow() assert "Erneuerungswahlen" not in manage assert "Kantonsratswahlen" in manage assert "Regierungsratswahlen" not in manage manage = client.get('/notices/submitted') manage.form['own'] = True manage = manage.form.submit().maybe_follow() assert "Erneuerungswahlen" not in manage assert "Kantonsratswahlen" in manage assert "Regierungsratswahlen" in manage