def test_fill_mail_author_with_FROM_data_if_user_does_not_exist(self):
        mail = self.create_mail()

        self.assertEquals(u'Freddy H\xf6lderlin <*****@*****.**>',
                          get_author_by_email(mail))

        self.assertEquals(get_author_by_email(mail), mail.document_author)
    def test_fill_mail_author_with_fullname_of_EXISTING_user(self):
        user = self.create_user()
        mail = self.create_mail()
        self.assertEquals(u'{0} {1}'.format(user.lastname, user.firstname),
                          get_author_by_email(mail))

        self.assertEquals(get_author_by_email(mail), mail.document_author)
    def test_fill_mail_author_with_FROM_data_if_user_does_not_exist(self):
        mail = self.create_mail()

        self.assertEquals(
            u'Freddy H\xf6lderlin <*****@*****.**>',
            get_author_by_email(mail))

        self.assertEquals(
            get_author_by_email(mail),
            mail.document_author)
    def test_fill_mail_author_with_fullname_of_EXISTING_user(self):
        user = self.create_user()
        mail = self.create_mail()
        self.assertEquals(
            u'{0} {1}'.format(user.lastname, user.firstname),
            get_author_by_email(mail))

        self.assertEquals(
            get_author_by_email(mail),
            mail.document_author)
    def test_mail_overview_tab(self, browser):
        mail = create(Builder('mail')
                      .with_asset_message(
                          'mail_with_multiple_attachments.eml'))
        browser.login().visit(mail, view='tabbedview_view-overview')

        expect = [['Document Date', date_format_helper(get_header_date(mail))],
                  ['Document Type', ''],
                  ['Author', get_author_by_email(mail)],
                  ['creator', 'Test User (test_user_1_)'],
                  ['Description', ''],
                  ['Foreign Reference', ''],
                  ['Message',
                   u'Mehrere Anhaenge.eml \u2014 32 KB '
                   u'Checkout and edit Download copy Attach to email'],
                  ['Attachments',
                   u'Inneres Testma\u0308il ohne Attachments.eml 1 KB '
                   'word_document.docx 22.4 KB '
                   'Text.txt 1 KB '
                   'Save attachments'],
                  ['Digital Available', 'yes'],
                  ['Preserved as paper', 'yes'],
                  ['Date of receipt', date_format_helper(date.today())],
                  ['Date of delivery', ''],
                  ['Classification', 'unprotected'],
                  ['Privacy layer', 'privacy_layer_no'],
                  ['Public Trial', 'unchecked'],
                  ['Public trial statement', '']]

        self.assertEquals(expect,
                          browser.css('table').first.lists())
예제 #6
0
    def initialize_required_metadata(self, mail):
        mail_metadata = IDocumentMetadata(mail)

        date_time = datetime.fromtimestamp(
            utils.get_date_header(mail.msg, 'Date'))
        mail_metadata.document_date = date_time.date()

        # Receipt date should be None for migrated mails
        mail_metadata.receipt_date = None
        mail_metadata.document_author = get_author_by_email(mail)
예제 #7
0
    def test_mail_overview_tab(self, browser):
        mail = create(
            Builder('mail').with_asset_message(
                'mail_with_multiple_attachments.eml'))
        browser.login().visit(mail, view='tabbedview_view-overview')

        view = mail.restrictedTraverse('tabbedview_view-overview')
        if not view.is_preview_supported():
            # Unexpected preconditions, print debug output for CI tests
            print "view.is_preview_supported() is unexpectedly False!"

            from opengever.base.pdfconverter import is_pdfconverter_enabled
            print "is_pdfconverter_enabled(): %r" % is_pdfconverter_enabled()

            import pkg_resources
            dist = pkg_resources.get_distribution('opengever.pdfconverter')
            print(
                "pkg_resources.get_distribution"
                "('opengever.pdfconverter'): %r" % dist)

            from opengever.bumblebee import is_bumblebee_feature_enabled
            print("is_bumblebee_feature_enabled(): "
                  "%r" % is_bumblebee_feature_enabled())

        expect = [['Document Date',
                   date_format_helper(get_header_date(mail))],
                  ['Document Type', ''], ['Author',
                                          get_author_by_email(mail)],
                  ['creator', 'Test User (test_user_1_)'], ['Description', ''],
                  ['Foreign Reference', ''],
                  [
                      'Original message', u'mehrere-anhange.eml \u2014 32 KB '
                      u'Checkout and edit Download copy'
                  ],
                  [
                      'Attachments',
                      'Inneres Testma?il ohne Attachments.eml 1 KB '
                      'word_document.docx 22.4 KB '
                      'Text.txt 1 KB '
                      'Save attachments'
                  ], ['Digital Available',
                      'yes'], ['Preserved as paper', 'yes'],
                  ['Date of receipt',
                   date_format_helper(date.today())], ['Date of delivery', ''],
                  ['Classification', 'unprotected'],
                  ['Privacy layer', 'privacy_layer_no'],
                  ['Public Trial', 'unchecked'],
                  ['Public trial statement', '']]

        self.assertEquals(expect, browser.css('table').first.lists())
    def test_mail_overview_tab(self, browser):
        mail = create(Builder('mail')
                      .with_asset_message(
                          'mail_with_multiple_attachments.eml'))
        browser.login().visit(mail, view='tabbedview_view-overview')

        view = mail.restrictedTraverse('tabbedview_view-overview')
        if not view.is_preview_supported():
            # Unexpected preconditions, print debug output for CI tests
            print "view.is_preview_supported() is unexpectedly False!"

            from opengever.base.pdfconverter import is_pdfconverter_enabled
            print "is_pdfconverter_enabled(): %r" % is_pdfconverter_enabled()

            import pkg_resources
            dist = pkg_resources.get_distribution('opengever.pdfconverter')
            print("pkg_resources.get_distribution"
                  "('opengever.pdfconverter'): %r" % dist)

            from opengever.bumblebee import is_bumblebee_feature_enabled
            print ("is_bumblebee_feature_enabled(): "
                   "%r" % is_bumblebee_feature_enabled())

        expect = [['Document Date', date_format_helper(get_header_date(mail))],
                  ['Document Type', ''],
                  ['Author', get_author_by_email(mail)],
                  ['creator', 'Test User (test_user_1_)'],
                  ['Description', ''],
                  ['Foreign Reference', ''],
                  ['Original message',
                   u'mehrere-anhange.eml \u2014 32 KB '
                   u'Checkout and edit Download copy'],
                  ['Attachments',
                   'Inneres Testma?il ohne Attachments.eml 1 KB '
                   'word_document.docx 22.4 KB '
                   'Text.txt 1 KB '
                   'Save attachments'],
                  ['Digital Available', 'yes'],
                  ['Preserved as paper', 'yes'],
                  ['Date of receipt', date_format_helper(date.today())],
                  ['Date of delivery', ''],
                  ['Classification', 'unprotected'],
                  ['Privacy layer', 'privacy_layer_no'],
                  ['Public Trial', 'unchecked'],
                  ['Public trial statement', '']]

        self.assertEquals(expect,
                          browser.css('table').first.lists())
예제 #9
0
    def test_mail_overview_tab(self, browser):
        mail = create(Builder("mail").with_message(MAIL_DATA))
        browser.login().visit(mail, view='tabbedview_view-overview')

        expect = [['Document Date', date_format_helper(get_header_date(mail))],
                  ['Document Type', ''],
                  ['Author', get_author_by_email(mail)],
                  ['creator', 'Test User (test_user_1_)'],
                  ['Description', ''],
                  ['Foreign Reference', ''],
                  ['Original message', u'die-burgschaft.eml \u2014 1 KB Download copy'],
                  ['Digital Available', 'yes'],
                  ['Preserved as paper', 'yes'],
                  ['Date of receipt', date_format_helper(date.today())],
                  ['Date of delivery', ''],
                  ['Classification', 'unprotected'],
                  ['Privacy layer', 'privacy_layer_no'],
                  ['Public Trial', 'unchecked'],
                  ['Public trial statement', '']]

        self.assertEquals(expect,
                          browser.css('table').first.lists())