def test_closing_meeting_does_not_regenerate_edited_protocol(self, browser): self.login(self.committee_responsible, browser) model = self.meeting.model # Make sure there is already a protocol generated: model.update_protocol_document() self.assertEquals(0, model.protocol_document.generated_version) # Fake editing the protocol document = model.protocol_document.resolve_document() versioner = Versioner(document) versioner.create_initial_version() versioner.create_version("bumb version") # When closing the meeting, we should end up with a new version browser.open(self.meeting) self.assertEquals( ['Closing the meeting will not update the protocol automatically.' '\nMake sure to transfer your changes or recreate the protocol.', 'Are you sure you want to close this meeting?'], browser.css('#confirm_close_meeting p').text) model.close() self.assertEquals(0, model.protocol_document.generated_version) self.assertEquals(u'closed', model.workflow_state)
def test_closing_meeting_does_not_regenerate_edited_protocol( self, browser): self.login(self.committee_responsible, browser) model = self.meeting.model # Make sure there is already a protocol generated: model.update_protocol_document() self.assertEquals(0, model.protocol_document.generated_version) # Fake editing the protocol document = model.protocol_document.resolve_document() versioner = Versioner(document) versioner.create_initial_version() versioner.create_version("bumb version") # When closing the meeting, we should end up with a new version browser.open(self.meeting) self.assertEquals([ 'Closing the meeting will not update the protocol automatically.' '\nMake sure to transfer your changes or recreate the protocol.', 'Are you sure you want to close this meeting?' ], browser.css('#confirm_close_meeting p').text) model.close() self.assertEquals(0, model.protocol_document.generated_version) self.assertEquals(u'closed', model.workflow_state)
def test_download_copy_without_overlay_creates_journal_entry(self, browser): self.login(self.regular_user, browser) versioner = Versioner(self.document) versioner.create_version('Initial version.') DownloadConfirmationHelper(self.document).deactivate() browser.open(self.document, view='tabbed_view/listing', data={'view_name': 'overview'}) browser.find('Download copy').click() self.assert_journal_entry(self.document, 'File copy downloaded', 'Download copy current version (0)')
def test_protocol_generate_action_only_available_for_unedited_protocols( self, browser): self.login(self.committee_responsible, browser) self.schedule_paragraph(self.meeting, u'A-Gesch\xe4fte') self.schedule_proposal(self.meeting, self.submitted_proposal) meeting = self.meeting.model self.assertIsNone(meeting.protocol_document) browser.open(meeting.get_url()) # generate first protocol generate_button = browser.css( '.meeting-document.protocol-doc .action.generate').first # Make sure we have the action without overwrite self.assertIn("overwrite=False", generate_button.get("href")) generate_button.click() statusmessages.assert_message( u'Protocol for meeting 9. Sitzung der ' u'Rechnungspr\xfcfungskommission has been generated ' u'successfully.') self.assertIsNotNone(meeting.protocol_document) self.assertEqual(0, meeting.protocol_document.generated_version) # Fake editing the protocol document = meeting.protocol_document.resolve_document() versioner = Versioner(document) versioner.create_initial_version() versioner.create_version("bumb version") # Without reloading the page, we still have the link to update the protocol # without confirmation generate_button = browser.css( '.meeting-document.protocol-doc .action.generate').first # Make sure we have the action without overwrite self.assertIn("overwrite=False", generate_button.get("href")) generate_button.click() # Protocol was not updated, as update needs confirmation self.assertEqual(0, meeting.protocol_document.generated_version) statusmessages.assert_message( u'Protocol for meeting 9. Sitzung der Rechnungspr\xfcfungskommission ' 'has not been updated. The protocol has been modified manually and ' 'these modifications will be lost if you regenerate the protocol.') # Reload browser page and make sure we now have the link with confirmation browser.open(meeting.get_url()) generate_button = browser.css( '.meeting-document.protocol-doc .action.generate').first self.assertIn("overwrite=True", generate_button.get("href")) self.assertEqual('generate_protocol_with_confirm', generate_button.get("id")) generate_button.click() statusmessages.assert_message( u'Protocol for meeting 9. Sitzung der ' u'Rechnungspr\xfcfungskommission has been updated successfully.') self.assertIsNotNone(meeting.protocol_document) self.assertEqual(2, meeting.protocol_document.generated_version)
def test_download_copy_with_overlay_creates_journal_entry(self, browser): self.login(self.regular_user, browser) versioner = Versioner(self.document) versioner.create_version('Initial version') versioner.create_version('Some updates.') browser.open(self.document, view='tabbed_view/listing', data={'view_name': 'overview'}) browser.find('Download copy').click() browser.find('label_download').click() self.assert_journal_entry(self.document, 'File copy downloaded', 'Download copy current version (1)')
def test_protocol_generate_action_only_available_for_unedited_protocols(self, browser): self.login(self.committee_responsible, browser) self.schedule_paragraph(self.meeting, u'A-Gesch\xe4fte') self.schedule_proposal(self.meeting, self.submitted_proposal) meeting = self.meeting.model self.assertIsNone(meeting.protocol_document) browser.open(meeting.get_url()) # generate first protocol generate_button = browser.css('.meeting-document.protocol-doc .action.generate').first # Make sure we have the action without overwrite self.assertIn("overwrite=False", generate_button.get("href")) generate_button.click() statusmessages.assert_message( u'Protocol for meeting 9. Sitzung der ' u'Rechnungspr\xfcfungskommission has been generated ' u'successfully.') self.assertIsNotNone(meeting.protocol_document) self.assertEqual(0, meeting.protocol_document.generated_version) # Fake editing the protocol document = meeting.protocol_document.resolve_document() versioner = Versioner(document) versioner.create_initial_version() versioner.create_version("bumb version") # Without reloading the page, we still have the link to update the protocol # without confirmation generate_button = browser.css('.meeting-document.protocol-doc .action.generate').first # Make sure we have the action without overwrite self.assertIn("overwrite=False", generate_button.get("href")) generate_button.click() # Protocol was not updated, as update needs confirmation self.assertEqual(0, meeting.protocol_document.generated_version) statusmessages.assert_message( u'Protocol for meeting 9. Sitzung der Rechnungspr\xfcfungskommission ' 'has not been updated. The protocol has been modified manually and ' 'these modifications will be lost if you regenerate the protocol.') # Reload browser page and make sure we now have the link with confirmation browser.open(meeting.get_url()) generate_button = browser.css('.meeting-document.protocol-doc .action.generate').first self.assertIn("overwrite=True", generate_button.get("href")) self.assertEqual('generate_protocol_with_confirm', generate_button.get("id")) generate_button.click() statusmessages.assert_message( u'Protocol for meeting 9. Sitzung der ' u'Rechnungspr\xfcfungskommission has been updated successfully.') self.assertIsNotNone(meeting.protocol_document) self.assertEqual(2, meeting.protocol_document.generated_version)
def test_download_confirmation_view_for_version_download(self, browser): self.login(self.regular_user, browser) versioner = Versioner(self.document) versioner.create_version('Initial version') versioner.create_version('Some updates.') browser.open(self.document, view='file_download_confirmation', data={'version_id': 1}) self.assertEqual( "You're downloading a copy of the document Vertraegsentwurf.docx", browser.css(".details > p").first.text, ) browser.find('label_download').click() expected_url = "{}/download_file_version?version_id=1".format(self.document.absolute_url()) self.assertEqual(expected_url, browser.url) self.assertEqual(self.document.file.data, browser.contents)
def test_initial_version_principal_is_documents_original_creator( self, browser): self.login(self.regular_user) # Guard assertion to make sure creatore of the fixture-document is # what we expect it to be. self.assertEqual('robert.ziegler', self.document.Creator()) self.document.file = NamedBlobFile(data='New', filename=u'test.txt') versioner = Versioner(self.document) versioner.create_version(comment='') initial_version_md = versioner.get_version_metadata(0) first_version_md = versioner.get_version_metadata(1) self.assertEqual('robert.ziegler', initial_version_md['sys_metadata']['principal']) self.assertEqual('kathi.barfuss', first_version_md['sys_metadata']['principal'])
def test_download_versioned_copy_creates_journal_entries_with_versions_in_title(self, browser): self.login(self.regular_user, browser) versioner = Versioner(self.document) versioner.create_version('Initial version') versioner.create_version('Some updates.') browser.open(self.document, view='tabbedview_view-versions') browser.css('a.function-download-copy').first.click() browser.find('label_download').click() self.assert_journal_entry(self.document, 'File copy downloaded', 'Download copy version 1') versioner.create_version('Oops.') browser.open(self.document, view='tabbedview_view-versions') browser.css('a.function-download-copy').first.click() browser.find('label_download').click() self.assert_journal_entry(self.document, 'File copy downloaded', 'Download copy version 2')