コード例 #1
0
    def test_expect_one_journal_entry_after_upload(self):
        content = create(
            Builder('quickuploaded_document').within(
                self.dossier).with_asset_data('text.txt'))

        history = JournalHistory(content, content.REQUEST)
        self.assertEquals(1, len(history.data()),
                          'Expect exactly one journal entry after upload')
コード例 #2
0
    def test_title_is_used_as_default_title_for_journal_entry(self):
        content = create(Builder('quickuploaded_document')
                         .within(self.dossier)
                         .with_data('text'))
        history = JournalHistory(content, content.REQUEST)

        self.assertEquals(u'Document added: document',
                          translate(history.data()[0]['action']['title']),
                          'Expected the document title in the action title')
コード例 #3
0
    def test_expect_one_journal_entry_after_upload(self):
        content = create(Builder('quickuploaded_document')
                         .within(self.dossier)
                         .with_asset_data('text.txt'))
        history = JournalHistory(content, content.REQUEST)

        self.assertEquals(1,
                          len(history.data()),
                          'Expect exactly one journal entry after upload')
コード例 #4
0
    def assert_download_journal_entry_created(self, document):
        request = self.layer['request']

        journal = JournalHistory(document, request)
        entry = journal.data()[-1]
        translated_action_title = translate(entry['action']['title'],
                                            context=request)
        self.assertEqual(u'Download copy', translated_action_title)
        self.assertEquals(TEST_USER_ID, entry['actor'])
        self.assertDictContainsSubset({'type': 'File copy downloaded',
                                       'visible': True},
                                      entry['action'])
コード例 #5
0
    def assert_download_journal_entry_created(self, document):
        request = self.layer['request']

        journal = JournalHistory(document, request)
        entry = journal.data()[-1]
        translated_action_title = translate(entry['action']['title'],
                                            context=request)
        self.assertEqual(u'Download copy', translated_action_title)
        self.assertEquals(TEST_USER_ID, entry['actor'])
        self.assertDictContainsSubset(
            {
                'type': 'File copy downloaded',
                'visible': True
            }, entry['action'])
コード例 #6
0
    def assert_download_journal_entry_created(
            self, document, expected_title=None):
        if expected_title is None:
            expected_title = u'Download copy current version ({version_id})'.format(  # noqa
                version_id=document.version_id)

        request = self.layer['request']

        journal = JournalHistory(document, request)
        entry = journal.data()[-1]
        translated_action_title = translate(entry['action']['title'],
                                            context=request)
        self.assertEqual(expected_title, translated_action_title)
        self.assertEquals(TEST_USER_ID, entry['actor'])
        self.assertDictContainsSubset({'type': 'File copy downloaded',
                                       'visible': True},
                                      entry['action'])
コード例 #7
0
    def assert_download_journal_entry_created(
            self, document, expected_title=None):
        if expected_title is None:
            expected_title = u'Download copy current version ({version_id})'.format(  # noqa
                version_id=document.version_id)

        request = self.layer['request']

        journal = JournalHistory(document, request)
        entry = journal.data()[-1]
        translated_action_title = translate(entry['action']['title'],
                                            context=request)
        self.assertEqual(expected_title, translated_action_title)
        self.assertEquals(TEST_USER_ID, entry['actor'])
        self.assertDictContainsSubset({'type': 'File copy downloaded',
                                       'visible': True},
                                      entry['action'])