예제 #1
0
    def test_result_location_is_shown(self, browser):
        chapter = create(Builder('chapter')
                         .titled('Chapter')
                         .within(self.book))

        subchapter = create(Builder('chapter')
                            .titled('SubChapter')
                            .within(chapter))

        create(Builder('book textblock')
               .within(subchapter)
               .titled('The Block')
               .having(text=keywords_html('Foo'),
                       showTitle=True))

        browser.login().open(self.book,
                             {'book_keywords': 'Foo'},
                             view='tabbedview_view-keywords/load')

        self.assertEquals(['The Book', '1 Chapter', '1.1 SubChapter'],
                          browser.css('.result-location a').text)

        self.assertEquals(
            'http://nohost/plone/the-book/@@book_reader_view',
            browser.css('.result-location a').first.attrib['href'])
예제 #2
0
    def test_only_search_for_results_in_this_book(self, browser):
        # Regression: when having the same keyword in multiple books
        # the keyword tab was broken because of unspecific query (no path).

        first_book = create(Builder('book').titled('First Book'))
        first_chapter = create(Builder('chapter').titled('First chapter')
                               .within(first_book))
        create(Builder('book textblock').titled('First Block')
               .within(first_chapter)
               .having(text=keywords_html('Foo', 'Bar')))

        second_book = create(Builder('book').titled('Second Book'))
        second_chapter = create(Builder('chapter').titled('Second chapter')
                                .within(second_book))
        create(Builder('book textblock').titled('Second Block')
               .within(second_chapter)
               .having(text=keywords_html('Bar', 'Baz')))

        browser.login().visit(first_book, view='tabbedview_view-keywords')
        self.assertItemsEqual(
            ['Foo', 'Bar', ''],
            browser.css('select[name=book_keywords] option').text,
            'Only keywords from the current book should be selectable.')

        browser.login().open(first_book,
                             {'book_keywords': 'Bar'},
                             view='tabbedview_view-keywords/load')
        self.assertEquals(1, len(browser.css('.result')),
                          'Only results from the current book should be'
                          ' found.')
예제 #3
0
    def test_exclude_subsite(self, browser):
        subsite = create(Builder('folder')
                         .titled('The Subsite')
                         .providing(INavigationRoot))

        browser.login().visit(view='global_statusmessage_config')
        browser.fill(
            {'Active': True,
             'Type': 'information',
             'Title': 'Maintenance',
             'Message': 'Scheduled Maintenance',
             'Exclude sites': ['The Subsite']}).submit()


        browser.visit(self.portal)
        self.assertTrue(
            statusmessage(),
            'Status message should be visible on site root.')

        page_on_site_root = create(Builder('page'))
        browser.visit(page_on_site_root)
        self.assertTrue(
            statusmessage(),
            'Status message should be visible on pages within site root.')

        browser.visit(subsite)
        self.assertFalse(
            statusmessage(),
            'Status message should not be visible on subsite.')

        page_on_subsite = create(Builder('page').within(subsite))
        browser.visit(page_on_subsite)
        self.assertFalse(
            statusmessage(),
            'Status message should not be visible on pages within subsite.')
예제 #4
0
    def test_javascript_loaded_on_lawgiverized_content(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page, view='@@sharing')

        self.assertIn(SHARING_JS_RESOURCE, javascript_resources(),
                      'The sharing javascript should be loaded on'
                      ' lawgiverized content.')
예제 #5
0
 def test_role_description_is_not_displayed_when_missing(self, browser):
     page = create(Builder('page'))
     browser.login().visit(page,
                           view='lawgiver-sharing-describe-role',
                           data={'role': 'editor'})
     self.assertFalse(browser.css('.role-description'),
                      'Did not expect that "editor" has a role description.')
예제 #6
0
 def test_javascript_NOT_loaded_on_NON_lawgiverized_content(self, browser):
     folder = create(Builder('folder'))
     browser.login().visit(folder, view='@@sharing')
     self.assertNotIn(SHARING_JS_RESOURCE, javascript_resources(),
                      'The sharing javascript should NOT be loaded on'
                      ' Plone standard content without lawigver'
                      ' workflows.')
예제 #7
0
    def test_disable_for_anonymous(self, browser):
        subsite = create(Builder('folder')
                         .titled('The Subsite')
                         .providing(INavigationRoot))

        browser.login().visit(view='global_statusmessage_config')
        browser.fill(
            {'Active': True,
             'Type': 'information',
             'Title': 'Maintenance',
             'Message': 'Scheduled Maintenance'}).submit()

        browser.logout().visit(self.portal)
        self.assertTrue(
            statusmessage(),
            'Status should be visible for anonymous by default.')

        browser.login().visit(view='global_statusmessage_config')
        browser.fill(
            {'Show to anonymous users?': False}).submit()

        browser.visit(self.portal)
        self.assertTrue(
            statusmessage(),
            'Status should still visible for logged in users.')

        browser.logout().reload()
        self.assertFalse(
            statusmessage(),
            'Status should no longer be visible for anonymous in users.')
    def test_configuration_form_in_browser(self, browser):
        browser.login().open()

        # Create a service navigation through the configuration form.
        browser.find('Edit').click()
        browser.fill({
            'Service links': [
                {
                    'Label': u'Internal link',
                    'Internal link': self.folder,
                    'Icon': u'Music'
                },
                {
                    'Label': u'External link',
                    'External URL': u'http://www.4teamwork.ch',
                    'Icon': u'Heart'
                },
            ]
        }).save()
        self.assertEqual(
            'http://nohost/plone/a-folder',
            browser.find('Internal link').attrib['href'],
        )
        self.assertEqual(
            'http://www.4teamwork.ch',
            browser.find('External link').attrib['href'],
        )

        # Disable the service navigation
        browser.find('Edit').click()
        browser.fill({'Disable service links': True}).save()
        self.assertIsNone(browser.find('Internal link'))
        self.assertIsNone(browser.find('External link'))
예제 #9
0
    def test_og_on_plone_root(self, browser):
        browser.login().visit()

        self.assertOg('og:title', api.portal.get().Title())
        self.assertOg('og:url', self.portal.absolute_url())
        self.assertOg('og:type', u'website')
        self.assertOg('og:image', self.portal.absolute_url() + '/logo.jpg')
    def test_toggling_edit_mode(self, browser):
        self.grant('Manager')
        # The plone site should be "editable" by default for the site owner.
        browser.login().visit()
        self.assertTrue(
            self.is_editable(),
            'No ".documentEditable" found on site root. Markup changed?')

        # When we hit the "switch-editmode" view we are redirected back
        # to the context's default view:
        browser.visit(view='@@switch-editmode')
        self.assertEqual(
            self.portal.absolute_url(), browser.url,
            'Expected to be redirected to the context\'s default view but'
            ' (site root in this case) but was not.')

        # and now the document is no longer editable:
        self.assertFalse(self.is_editable(), 'Site root still editable.')

        # even when reloading:
        browser.visit()
        self.assertFalse(self.is_editable(),
                         'Editable switch not persistent?')

        # when switching back on we are redirected to the default view again:
        browser.visit(view='@@switch-editmode')
        self.assertEqual(
            self.portal.absolute_url(), browser.url,
            'Redirect seems to be wrong when re-enabling edit mode.')

        # and it is now editable again:
        self.assertTrue(self.is_editable(),
                        'Re-enabling the edit mode is not working.')
 def test_role_description_is_not_displayed_when_missing(self, browser):
     page = create(Builder('page'))
     browser.login().visit(page,
                           view='lawgiver-sharing-describe-role',
                           data={'role': 'editor'})
     self.assertFalse(browser.css('.role-description'),
                      'Did not expect that "editor" has a role description.')
 def test_javascript_NOT_loaded_on_NON_lawgiverized_content(self, browser):
     folder = create(Builder('folder'))
     browser.login().visit(folder, view='@@sharing')
     self.assertNotIn(SHARING_JS_RESOURCE, javascript_resources(self.layer['portal']),
                      'The sharing javascript should NOT be loaded on'
                      ' Plone standard content without lawigver'
                      ' workflows.')
예제 #13
0
    def test_base_url_falls_back_to_page_url(self, browser):
        portal_url = self.layer['portal'].absolute_url() + '/'
        # The test-form-result returns json and thus has no base tag
        view_url = portal_url + 'test-form-result'

        browser.login(SITE_OWNER_NAME).open(view_url)
        self.assertEquals(view_url, browser.base_url)
    def test_content_expired_class_for_expired_content(self, browser):
        before_expiration = datetime(2010, 1, 1)
        expiration_date = datetime(2010, 2, 2)
        after_expiration = datetime(2010, 3, 3)

        create(Builder('navigation portlet'))
        create(Builder('folder').titled('Top Sibling')
               .having(expirationDate=expiration_date))
        folder = create(Builder('folder').titled('The Folder')
                        .having(expirationDate=expiration_date))
        create(Builder('page').titled('The Page').within(folder)
               .having(expirationDate=expiration_date))
        create(Builder('folder').titled('Bottom Sibling')
               .having(expirationDate=expiration_date))

        with freeze(after_expiration):
            browser.login().visit(folder)
            self.assertIn('content-expired', portlet().css('.sibling')[0].classes)
            self.assertIn('content-expired', portlet().css('.current').first.classes)
            self.assertIn('content-expired', portlet().css('.child').first.classes)
            self.assertIn('content-expired', portlet().css('.sibling')[1].classes)

        with freeze(before_expiration):
            browser.login().visit(folder)
            self.assertNotIn('content-expired', portlet().css('.sibling')[0].classes)
            self.assertNotIn('content-expired',
                             portlet().css('.current').first.classes)
            self.assertNotIn('content-expired', portlet().css('.child').first.classes)
            self.assertNotIn('content-expired', portlet().css('.sibling')[1].classes)
예제 #15
0
    def test_message_when_there_are_no_results(self, browser):
        browser.login().open(self.book,
                             {'book_keywords': 'Foo'},
                             view='tabbedview_view-keywords/load')

        self.assertEquals('No results found.',
                          browser.css('.no-results').first.text)
예제 #16
0
    def api_request(self,
                    method,
                    action,
                    data=(),
                    authenticate=True,
                    context=None):
        if context is None:
            context = self.layer['portal']
        if authenticate:
            browser.login(SITE_OWNER_NAME)
        else:
            browser.logout()

        with verbose_logging():
            if method.lower() == 'get':
                browser.visit(context,
                              view='upgrades-api/{0}?{1}'.format(
                                  action, urllib.urlencode(data)))

            elif method.lower() == 'post':
                if not data:
                    data = {'enforce': 'post'}
                browser.visit(context,
                              view='upgrades-api/{0}'.format(action),
                              data=data)

            else:
                raise Exception(
                    'Unsupported request method {0}'.format(method))
예제 #17
0
def visit(specification_title):
    browser.login(SITE_OWNER_NAME)
    browser.open(view='lawgiver-list-specs')
    specs = browser.css('dl.specifications').first
    link = specs.find(specification_title)
    assert link, 'Spec {!r} not found in {!r}'.format(specification_title,
                                                      specs.terms)
    link.click()
예제 #18
0
    def test_og_on_simplelayout_page(self, browser):
        page = create(Builder('sl content page').titled(u'\xfc Title'))
        browser.login().visit(page)

        self.assertOg('og:title', page.Title().decode('utf-8'))
        self.assertOg('og:url', page.absolute_url())
        self.assertOg('og:type', u'website')
        self.assertOg('og:image', self.portal.absolute_url() + '/logo.jpg')
예제 #19
0
def visit(specification_title):
    browser.login(SITE_OWNER_NAME)
    browser.open(view='lawgiver-list-specs')
    specs = browser.css('dl.specifications').first
    link = specs.find(specification_title)
    assert link, 'Spec {!r} not found in {!r}'.format(
        specification_title, specs.terms)
    link.click()
예제 #20
0
def visit_api(obj):
    browser.login(SITE_OWNER_NAME)
    browser.open(obj,
                 view='sharing',
                 headers={
                     'Accept': 'application/json',
                     'Content-Type': 'application/json',
                 })
예제 #21
0
    def test_cloning_a_browser_copies_headers(self, browser):
        browser.login().open()
        self.assertEquals(TEST_USER_ID, plone.logged_in())

        with browser.clone() as subbrowser:
            subbrowser.open()
            self.assertEquals(TEST_USER_ID, plone.logged_in(subbrowser))
            subbrowser.login(SITE_OWNER_NAME).reload()
            self.assertEquals(SITE_OWNER_NAME, plone.logged_in(subbrowser))
예제 #22
0
 def test_raises_insufficient_privileges_for_logged_in_user(self, browser):
     """When an logged in user accesses a protected content, Plone will
     redirect to a "require_login" script, rendering "Insufficient Privileges".
     By default, the ftw.testbrowser should raise an InsufficientPrivileges
     exception in this case.
     """
     browser.login()
     with self.assertRaises(InsufficientPrivileges):
         browser.open(view='plone_control_panel')
    def test_disable_service_nav_on_subsite(self, browser):
        subsite = create(Builder('folder').providing(INavigationRoot))
        self.set_links(self.portal)
        self.set_links(subsite, disable=True)

        browser.login().visit(subsite)
        self.assertFalse(
            browser.css(self.css_selector),
            'There are no Links, so no service nav should be rendered')
예제 #24
0
    def test_disable_service_nav_on_subsite(self, browser):
        subsite = create(Builder('folder').providing(INavigationRoot))
        self.set_links(self.portal)
        self.set_links(subsite, disable=True)

        browser.login().visit(subsite)
        self.assertFalse(
            browser.css(self.css_selector),
            'There are no Links, so no service nav should be rendered')
예제 #25
0
    def test_role_description_is_displayed_when_defined(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor-in-chief'})
        description = browser.css('.role-description').first.text

        # This description is set through translations in the Plone domain.
        self.assertEquals('The editor-in-chief reviews and publishes content.',
                          description)
예제 #26
0
    def test_keywords_only_available_when_use_keywords_enabled(self, browser):
        tab_label = 'Keywords'
        browser.login().visit(self.book, view='tabbed_view')
        self.assertNotIn(tab_label, browser.css('.tabbedview-tabs a').text)

        self.book.setUse_index(True)
        transaction.commit()

        browser.login().visit(self.book, view='tabbed_view')
        self.assertIn(tab_label, browser.css('.tabbedview-tabs a').text)
    def test_error_message_when_no_role_Found(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              # "Reviewer" is not a spec role and is never displayd
                              # in the sharing view.
                              data={'role': 'Reviewer'})

        self.assertEquals('Could not find any information about this role.',
                          browser.css('p.error').first.text)
 def assert_edit_link(self, context, can_edit):
     browser.login().visit(context)
     if can_edit:
         self.assertTrue(
             browser.css('#service-navigation a.ModifyServiceNavigation'),
             'Modify navigation form link should be available.')
     else:
         self.assertFalse(
             browser.css('#service-navigation a.ModifyServiceNavigation'),
             'Modify navigation form link should NOT be available.')
예제 #29
0
    def test_error_message_when_no_role_Found(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              # "Reviewer" is not a spec role and is never displayd
                              # in the sharing view.
                              data={'role': 'Reviewer'})

        self.assertEquals('Could not find any information about this role.',
                          browser.css('p.error').first.text)
    def test_role_description_is_displayed_when_defined(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor-in-chief'})
        description = browser.css('.role-description').first.text

        # This description is set through translations in the Plone domain.
        self.assertEquals('The editor-in-chief reviews and publishes content.',
                          description)
예제 #31
0
 def assert_edit_link(self, context, can_edit):
     browser.login().visit(context)
     if can_edit:
         self.assertTrue(
             browser.css('#service-navigation a.ModifyServiceNavigation'),
             'Modify navigation form link should be available.')
     else:
         self.assertFalse(
             browser.css('#service-navigation a.ModifyServiceNavigation'),
             'Modify navigation form link should NOT be available.')
예제 #32
0
    def test_keywords_are_ordered_case_insensitive(self, browser):
        chapter = create(Builder('chapter').within(self.book))
        create(Builder('book textblock')
               .within(chapter)
               .having(text=keywords_html('foo', 'bar', 'Baz')))

        browser.login().visit(self.book, view='tabbedview_view-keywords')
        self.assertEquals(
            ['', 'bar', 'Baz', 'foo'],
            browser.css('select[name=book_keywords] option').text)
예제 #33
0
    def test_invisible_layout(self, browser):
        table = create(
            Builder('table').with_table(
                (('Foo', 'Bar'), ('1', '2'))).having(borderLayout='invisible'))

        browser.login().visit(table, view='block_view')

        self.assertEquals([[('Foo', NONE),
                            ('Bar', NONE)], [('1', NONE), ('2', NONE)]],
                          table_borders())
예제 #34
0
    def test_no_duplicate_keywords(self, browser):
        chapter = create(Builder('chapter').within(self.book))
        create(Builder('book textblock')
               .within(chapter)
               .having(text=keywords_html('Foo', 'bar', 'Foo')))

        browser.login().visit(self.book, view='tabbedview_view-keywords')
        self.assertItemsEqual(
            ['Foo', 'bar', ''],
            browser.css('select[name=book_keywords] option').text)
    def test_general_role_inheritance_is_respected(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor'})
        table = browser.css('table').first.dicts()

        self.assertIn({'Action': 'View',
                       'Private': TICK,
                       'Pending': TICK,
                       'Published': TICK}, table)
예제 #36
0
    def test_css_included_relative_to_navigation_root(self, browser):
        self.grant('Manager')
        folder = create(Builder('folder').titled(u'Folder'))

        browser.login().open(folder)
        self.assert_css_url_present('http://nohost/plone/theming.css')

        alsoProvides(folder, INavigationRoot)
        transaction.commit()
        browser.reload()
        self.assert_css_url_present('http://nohost/plone/folder/theming.css')
예제 #37
0
    def test_permissions_from_general_statements_are_included(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor'})
        table = browser.css('table').first.dicts()

        self.assertIn({'Action': 'Add',
                       'Private': TICK,
                       'Pending': TICK,
                       'Published': TICK}, table)
예제 #38
0
    def test_permissions_are_shown_per_status(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor'})
        table = browser.css('table').first.dicts()

        self.assertIn({'Action': 'Edit',
                       'Private': TICK,
                       'Pending': '',
                       'Published': ''}, table)
    def test_permissions_from_general_statements_are_included(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor'})
        table = browser.css('table').first.dicts()

        self.assertIn({'Action': 'Add',
                       'Private': TICK,
                       'Pending': TICK,
                       'Published': TICK}, table)
예제 #40
0
    def test_base_url_is_base_url_tag(self, browser):
        portal_url = self.layer['portal'].absolute_url() + '/'
        folder_contents_url = portal_url + 'folder_contents'

        browser.login(SITE_OWNER_NAME).open(folder_contents_url)
        if IS_PLONE_4:
            self.assertEquals(portal_url, browser.base_url)
        else:
            self.assertEquals(folder_contents_url, browser.base_url)

        self.assertEquals(folder_contents_url, browser.url)
    def test_permissions_are_shown_per_status(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor'})
        table = browser.css('table').first.dicts()

        self.assertIn({'Action': 'Edit',
                       'Private': TICK,
                       'Pending': '',
                       'Published': ''}, table)
예제 #42
0
    def test_general_role_inheritance_is_respected(self, browser):
        page = create(Builder('page'))
        browser.login().visit(page,
                              view='lawgiver-sharing-describe-role',
                              data={'role': 'editor'})
        table = browser.css('table').first.dicts()

        self.assertIn({'Action': 'View',
                       'Private': TICK,
                       'Pending': TICK,
                       'Published': TICK}, table)
    def test_link_to_non_existent_object_is_not_displayed(self, browser):
        self.set_links(self.portal)
        self.portal.manage_delObjects(self.portal.get('a-folder').id)
        transaction.commit()

        browser.login().visit(self.portal, view='service_navigation_form')
        browser.find_form_by_fields('Disable service links').submit()

        self.assertEqual(
            [item.text for item in browser.css(
                '#service-navigation ul li a:not(.ModifyServiceNavigation)')],
            ['External Link'])
예제 #44
0
    def test_link_to_non_existent_object_is_not_displayed(self, browser):
        self.set_links(self.portal)
        self.portal.manage_delObjects(self.portal.get('a-folder').id)
        transaction.commit()

        browser.login().visit(self.portal, view='service_navigation_form')
        browser.find_form_by_fields('Disable service links').submit()

        self.assertEqual([
            item.text for item in browser.css(
                '#service-navigation ul li a:not(.ModifyServiceNavigation)')
        ], ['External Link'])
예제 #45
0
    def test_block_title_is_shown(self, browser):
        chapter = create(Builder('chapter').within(self.book))
        create(Builder('book textblock')
               .within(chapter)
               .titled('The Block')
               .having(text=keywords_html('Foo'),
                       showTitle=True))

        browser.login().open(self.book,
                             {'book_keywords': 'Foo'},
                             view='tabbedview_view-keywords/load')

        self.assertEquals('1.1 The Block',
                          browser.css('.result .title').first.text)
예제 #46
0
    def test_load_results_by_keyword(self, browser):
        chapter = create(Builder('chapter').within(self.book))
        create(Builder('book textblock')
               .within(chapter)
               .having(text=keywords_html('Foo')))
        create(Builder('book textblock')
               .within(chapter)
               .having(text=keywords_html('Bar')))

        browser.login().open(self.book,
                             {'book_keywords': 'Foo'},
                             view='tabbedview_view-keywords/load')
        self.assertEquals(1, len(browser.css('.result')),
                          'Expected exactly one result')
예제 #47
0
    def test_no_duplicate_keywords_in_result(self, browser):
        chapter = create(Builder('chapter').within(self.book))
        create(Builder('book textblock')
               .within(chapter)
               .titled('The Block')
               .having(text=keywords_html('Foo', 'Bar', 'Foo'),
                       showTitle=True))

        browser.login().open(self.book,
                             {'book_keywords': 'Foo'},
                             view='tabbedview_view-keywords/load')

        self.assertEquals(['Bar,', 'Foo'],
                          browser.css('.result-keywords span').text)
예제 #48
0
    def test_error_status_message(self, browser):
        browser.login(SITE_OWNER_NAME).visit(
            view='global_statusmessage_config')
        browser.fill(
            {'Active': True,
             'Type': 'error',
             'Title': 'Outage',
             'Message': 'Some parts are not available'}).submit()

        self.assertEquals(
            {'type': 'error',
             'title': 'Outage',
             'message': 'Some parts are not available'},
            statusmessage())
    def create_mail(self):
        """Add mails over a plone view since builders implement their own
        instance construction.
        """

        with browser(self.app):
            dossier = create(Builder("dossier"))
            browser.login().open(dossier, view='++add++ftw.mail.mail')
            browser.fill({
                'Raw Message': (MAIL_DATA, 'mail.eml', 'message/rfc822')
            }).submit()

            mail = browser.context
            return mail
예제 #50
0
    def test_info_status_message(self, browser):
        browser.login(SITE_OWNER_NAME).visit(
            view='global_statusmessage_config')
        browser.fill(
            {'Active': True,
             'Type': 'information',
             'Title': 'Maintenance',
             'Message': 'Scheduled maintenance 20PM-22PM'}).submit()

        self.assertEquals(
            {'type': 'information',
             'title': 'Maintenance',
             'message': 'Scheduled maintenance 20PM-22PM'},
            statusmessage())
예제 #51
0
    def test_successfully_add_activity(self, member):
        create(Builder('ogds_user').having(userid='hugo.boss'))

        browser.login('hugo.boss').open(self.dossier,
                                        view='++add++opengever.task.task')
        browser.fill({'Title': 'Test Task', 'Task Type': 'comment'})

        form = browser.find_form_by_field('Responsible')
        form.find_widget('Responsible').fill('inbox:org-unit-1')
        form.find_widget('Issuer').fill(TEST_USER_ID)

        browser.css('#form-buttons-save').first.click()

        self.assertEquals([], warning_messages())
        self.assertEquals(['Item created'], info_messages())
예제 #52
0
    def test_disabling_status_message(self, browser):
        browser.login(SITE_OWNER_NAME).visit(
            view='global_statusmessage_config')
        browser.fill(
            {'Active': True,
             'Type': 'information',
             'Title': 'Maintenance',
             'Message': 'Scheduled maintenance 20PM-22PM'}).submit()
        self.assertTrue(statusmessage(),
                        'Expected a message to be configured.')

        browser.visit(view='global_statusmessage_config')
        browser.fill({'Active': False}).submit()
        self.assertFalse(statusmessage(),
                        'Expected message to be no longer visible.')
    def test_javascript_loaded_on_lawgiverized_content(self, browser):
        page = create(Builder('page'))

        if IS_PLONE_5:
            # Enable development of the Plone legacy JavaScript bundle.
            registry = getUtility(IRegistry)
            registry['plone.resources.development'] = True
            registry['plone.bundles/plone-legacy.develop_javascript'] = True
            transaction.commit()

        browser.login().visit(page, view='@@sharing')

        self.assertIn(SHARING_JS_RESOURCE, javascript_resources(self.layer['portal']),
                      'The sharing javascript should be loaded on'
                      ' lawgiverized content.')