def test_preview_link_is_only_available_when_pdfconverter_is_active(self, browser):  # noqa
        document = create(Builder('document').with_dummy_content())

        with PDFConverterAvailability(True):
            browser.login().open(document, view='tooltip')
            self.assertIn(
                'PDF Preview', browser.css('.file-action-buttons a').text)

        with PDFConverterAvailability(False):
            browser.open(document, view='tooltip')
            self.assertNotIn(
                'PDF Preview', browser.css('.file-action-buttons a').text)
Beispiel #2
0
    def test_preview_link_is_only_available_for_documents(self, browser):
        with PDFConverterAvailability(False):
            document = create(Builder('document').with_dummy_content())
            mail = create(Builder('mail').with_dummy_message())

        with PDFConverterAvailability(True):
            browser.login().open(document, view='tooltip')
            self.assertIn('PDF Preview',
                          browser.css('.file-action-buttons a').text)

            browser.open(mail, view='tooltip')
            self.assertNotIn('PDF Preview',
                             browser.css('.file-action-buttons a').text)
Beispiel #3
0
 def test_is_sorted_by_descending_version_id(self, browser):
     with PDFConverterAvailability(False):
         browser.login().open(self.document,
                              view='tabbedview_view-versions')
         listing = browser.css('.listing').first
         version_ids = [d['Version'] for d in listing.dicts()]
         self.assertEquals(['3', '2', '1', '0'], version_ids)
Beispiel #4
0
 def test_columns_are_ordered_and_translated(self, browser):
     with PDFConverterAvailability(False):
         browser.login().open(self.document,
                              view='tabbedview_view-versions')
         listing = browser.css('.listing').first
         column_headers = listing.lists()[0]
         self.assertEquals([
             'Version', u'Ge\xe4ndert von', 'Datum', 'Kommentar',
             'Kopie herunterladen', u'Zur\xfccksetzen'
         ], column_headers)
Beispiel #5
0
    def test_actor_is_linked(self, browser):
        with PDFConverterAvailability(False):
            browser.login().open(self.document,
                                 view='tabbedview_view-versions')
            listing = browser.css('.listing').first
            first_row = listing.css('tr')[1]
            actor_link = first_row.css('td a').first

            self.assertEquals('Boss Hugo (test-user)', actor_link.text)
            self.assertEquals('http://nohost/plone/@@user-details/test-user',
                              actor_link.attrib['href'])
Beispiel #6
0
    def test_revert_link_is_properly_constructed(self, browser):
        with PDFConverterAvailability(False):
            browser.login().open(self.document,
                                 view='tabbedview_view-versions')
            listing = browser.css('.listing').first
            first_row = listing.css('tr')[1]
            revert_link = first_row.css('td a')[-1]
            url = urlparse(revert_link.attrib['href'])
            query = parse_qs(url.query)

            self.assertEquals(u'Zur\xfccksetzen', revert_link.text)
            self.assertEquals(['3'], query['version_id'])
            self.assertIn('_authenticator', query)
            self.assertEquals(
                '/plone/dossier-1/document-1/revert-file-to-version', url.path)
Beispiel #7
0
    def test_download_pdf_link_is_properly_constructed(self, browser):
        with PDFConverterAvailability(True):
            browser.login().open(self.document,
                                 view='tabbedview_view-versions')

            listing = browser.css('.listing').first
            first_row = listing.css('tr')[1]
            pdf_download_link = first_row.css('td a')[-2]
            url = urlparse(pdf_download_link.attrib['href'])
            query = parse_qs(url.query)

            self.assertEquals('PDF-Vorschau', pdf_download_link.text)
            self.assertEquals(['3'], query['version_id'])
            self.assertIn('_authenticator', query)
            self.assertEquals(
                '/plone/dossier-1/document-1/download_pdf_version', url.path)
Beispiel #8
0
    def test_tooltip_actions(self, browser):
        with PDFConverterAvailability(True):
            dossier = create(Builder('dossier'))
            document = create(
                Builder('document').within(
                    dossier).with_dummy_content().attach_file_containing(
                        bumblebee_asset('example.docx').bytes(),
                        u'example.docx'))

            browser.login().open(document, view='tooltip')
            metadata, checkout, download, preview, details = browser.css(
                '.file-action-buttons a')

            # preview
            self.assertEquals('PDF Preview', preview.text)
            self.assertTrue(
                preview.get('href').startswith(
                    'http://nohost/plone/dossier-1/document-1'
                    '/download_pdfpreview?_authenticator='))

            # metadata
            self.assertEquals('Edit metadata', metadata.text)
            self.assertEquals(
                'http://nohost/plone/dossier-1/document-1'
                '/edit_checker', metadata.get('href'))

            # checkout and edit
            self.assertEquals('Checkout and edit', checkout.text)
            self.assertTrue(
                checkout.get('href').startswith(
                    'http://nohost/plone/dossier-1/document-1'
                    '/editing_document?_authenticator='))

            # download copy
            self.assertEquals('Download copy', download.text)
            self.assertTrue(
                download.get('href').startswith(
                    'http://nohost/plone/dossier-1/document-1'
                    '/file_download_confirmation?_authenticator='))

            # link to details
            self.assertEquals('Open detail view', details.text)
            self.assertEquals('http://nohost/plone/dossier-1/document-1',
                              details.get('href'))
Beispiel #9
0
 def test_dates_are_formatted_correctly(self, browser):
     with PDFConverterAvailability(False):
         with freeze(datetime(2015, 01, 28, 12, 00)):
             doc = self._create_doc()
         with freeze(datetime(2015, 01, 28, 18, 30)):
             create_document_version(doc, 1)