Exemple #1
0
    def test_loggedin_search(self):
        # Setup
        portal = self.layer['portal']

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.open(portal.absolute_url() + '/search')
        self.assertEqual(browser.url, portal.absolute_url() + '/search')
    def test_loggedin_search(self):
        # Setup
        portal = self.layer['portal']

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.open(portal.absolute_url() + '/search')
        self.assertEqual(browser.url, portal.absolute_url() + '/search')
Exemple #3
0
    def test_non_participants_cannot_see_private_projectroom_in_navigation(
            self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')
        wt.doActionFor(folder, "publish")

        projectroom_id = folder.invokeFactory('ProjectRoom',
                                              'wibblewobblewoo',
                                              title="wibblewobblewoo")
        projectroom = folder[projectroom_id]

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('nonparticipant', 'secret', ['Member'], [])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('nonparticipant', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        browser.open(folder.absolute_url())
        self.assertFalse("wibblewobblewoo" in browser.contents)

        # We then make it public
        wt.doActionFor(projectroom, 'publish')
        transaction.commit()

        browser.open(folder.absolute_url())
        self.assertTrue("wibblewobblewoo" in browser.contents)
    def test_non_participants_cannot_see_private_projectroom_in_navigation(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')
        wt.doActionFor(folder, "publish")

        projectroom_id = folder.invokeFactory('ProjectRoom', 'wibblewobblewoo', title="wibblewobblewoo")
        projectroom = folder[projectroom_id]

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('nonparticipant', 'secret', ['Member'], [])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('nonparticipant', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        browser.open(folder.absolute_url())
        self.assertFalse("wibblewobblewoo" in browser.contents)

        # We then make it public
        wt.doActionFor(projectroom, 'publish')
        transaction.commit()

        browser.open(folder.absolute_url())
        self.assertTrue("wibblewobblewoo" in browser.contents)
Exemple #5
0
 def test_user_view(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     browser.open(portal.absolute_url() + '/users')
     self.assertTrue('href="http://nohost/plone/users/test_user_1_"' in
         browser.contents)
    def test_anonymous_robotstxt(self):
        # Setup
        portal = self.layer['portal']

        browser = get_browser(self.layer['app'], loggedIn=False)
        browser.open(portal.absolute_url() + '/robots.txt')
        self.assertEqual(browser.url, portal.absolute_url() + '/robots.txt')
Exemple #7
0
    def test_anonymous_robotstxt(self):
        # Setup
        portal = self.layer['portal']

        browser = get_browser(self.layer['app'], loggedIn=False)
        browser.open(portal.absolute_url() + '/robots.txt')
        self.assertEqual(browser.url, portal.absolute_url() + '/robots.txt')
Exemple #8
0
 def test_user_view(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     browser.open(portal.absolute_url() + '/users')
     self.assertTrue('href="http://nohost/plone/users/test_user_1_"' in
                     browser.contents)
Exemple #9
0
 def test_users_listing_view(self):
     # As a normal user we can view the listing
     browser = get_browser(self.layer['app'])
     browser.open('http://nohost/plone/users/')
     self.failUnless('Barney Rubble' in browser.contents)
     self.failUnless('http://nohost/plone/users/barney' in browser.contents)
     self.failUnless('Fred Flintstone' in browser.contents)
     self.failUnless('http://nohost/plone/users/fred' in browser.contents)
Exemple #10
0
 def test_anonymous_user(self):
     browser = get_browser(self.layer['app'], loggedIn=False)
     browser.handleErrors = False
     portal = self.layer['portal']
     try:
         browser.open(portal.absolute_url() + '/users/test_user_1_')
     except Unauthorized, e:
         self.assertEqual('%s' % (e, ), 'Anonymous rejected')
Exemple #11
0
 def test_anonymous_user(self):
     browser = get_browser(self.layer['app'], loggedIn=False)
     browser.handleErrors = False
     portal = self.layer['portal']
     try:
         browser.open(portal.absolute_url() + '/users/test_user_1_')
     except Unauthorized, e:
         self.assertEqual('%s' % (e, ), 'Anonymous rejected')
    def test_anonymous_search(self):
        # Setup
        portal = self.layer['portal']

        browser = get_browser(self.layer['app'], loggedIn=False)
        browser.open(portal.absolute_url() + '/search')
        self.assertNotEqual(browser.url, portal.absolute_url() + '/search')
        self.assertTrue('require_login' in browser.url)
 def test_users_listing_view(self):
     # As a normal user we can view the listing
     browser = get_browser(self.layer['app'])
     browser.open('http://nohost/plone/users/')
     self.failUnless('Barney Rubble' in browser.contents)
     self.failUnless('http://nohost/plone/users/barney' in browser.contents)
     self.failUnless('Fred Flintstone' in browser.contents)
     self.failUnless('http://nohost/plone/users/fred' in browser.contents)
Exemple #14
0
    def test_anonymous_search(self):
        # Setup
        portal = self.layer['portal']

        browser = get_browser(self.layer['app'], loggedIn=False)
        browser.open(portal.absolute_url() + '/search')
        self.assertNotEqual(browser.url, portal.absolute_url() + '/search')
        self.assertTrue('require_login' in browser.url)
Exemple #15
0
 def test_unknown_member(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = True
     portal = self.layer['portal']
     try:
         browser.open(portal.absolute_url() + '/users/test_user_2_')
     except urllib2.HTTPError, e:
         self.assertEqual(e.getcode(), 404)
         self.assertEqual('%s' % (e, ), 'HTTP Error 404: Not Found')
Exemple #16
0
 def test_unknown_member(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = True
     portal = self.layer['portal']
     try:
         browser.open(portal.absolute_url() + '/users/test_user_2_')
     except urllib2.HTTPError, e:
         self.assertEqual(e.getcode(), 404)
         self.assertEqual('%s' % (e, ), 'HTTP Error 404: Not Found')
Exemple #17
0
    def test_anon_frontpage(self):
        portal = self.layer['portal']
        browser = get_browser(self.layer['app'], loggedIn=False)

        # Navigating to the front page redirects us to the login form
        browser.open(portal.absolute_url())
        self.assert_('require_login' in browser.url)
        self.assert_('template-login_form' in browser.contents)
        self.assert_('id="login_form"' in browser.contents)
Exemple #18
0
 def test_anonymous_user(self):
     browser = get_browser(self.layer['app'], loggedIn=False)
     browser.handleErrors = False
     portal = self.layer['portal']
     try:
         browser.open(portal.absolute_url() + '/users')
     except Unauthorized:
         pass
     else:
         self.fail('Unauthorized not raised') # pragma: no cover
Exemple #19
0
 def test_anonymous_user(self):
     browser = get_browser(self.layer['app'], loggedIn=False)
     browser.handleErrors = False
     portal = self.layer['portal']
     try:
         browser.open(portal.absolute_url() + '/users')
     except Unauthorized:
         pass
     else:
         self.fail('Unauthorized not raised')  # pragma: no cover
Exemple #20
0
    def test_add_edit_forms(self):
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        wt = getToolByName(portal, 'portal_workflow')
        portal.invokeFactory('Document', 'adoc',
                             title='A document')
        wt.doActionFor(portal['adoc'], 'publish')
        title = portal['adoc'].Title()
        transaction.commit()
        browser = get_browser(self.layer['app'], loggedIn=True)
        url = portal.absolute_url() + \
            '/++contextportlets++plone.leftcolumn/+/' + \
            'intranett.policy.portlets.ContentHighlight'
        # Missing input
        browser.open(url)
        browser.getControl(name='form.buttons.add').click()
        self.assertEqual(browser.url, url)
        self.assertTrue('Required input is missing.' in browser.contents)
        # Add
        browser.getControl(name='form.widgets.portletTitle').value = 'A title'
        browser.getControl(
            name="form.widgets.item.widgets.query").value = title
        browser.getControl(name='form.buttons.add').click()
        browser.getControl(name='form.widgets.item:list').value = [title]
        browser.getControl(name='form.buttons.add').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
        # Cancel add
        browser.open(url)
        browser.getControl(name='form.buttons.cancel_add').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')

        url = portal.absolute_url() + \
            '/++contextportlets++plone.leftcolumn/' + \
            'content-highlight/edit'
        # Missing input
        browser.open(url)
        browser.getControl(name='form.widgets.portletTitle').value = ''
        browser.getControl(name='form.buttons.apply').click()
        self.assertEqual(browser.url, url)
        self.assertTrue('Required input is missing.' in browser.contents)
        # Edit without changes
        browser.getControl(name='form.widgets.portletTitle').value = 'A title'
        browser.getControl(name='form.buttons.apply').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
        # Edit with changes
        browser.open(url)
        browser.getControl(name='form.widgets.portletTitle').value = 'Title 2'
        browser.getControl(name='form.buttons.apply').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
        # Cancel edit
        browser.open(url)
        browser.getControl(name='form.buttons.cancel_add').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
    def test_projectroom_creator_can_view_projectroom(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.open(projectroom.absolute_url())
Exemple #22
0
    def test_projectroom_creator_can_view_projectroom(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.open(projectroom.absolute_url())
Exemple #23
0
 def test_browser_default(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     mt = getToolByName(portal, 'portal_membership')
     member = mt.getAuthenticatedMember()
     member.setMemberProperties(
         {'fullname': 'Bob Døe', 'email': '*****@*****.**'})
     transaction.commit()
     browser.open(portal.absolute_url() + '/users/test_user_1_')
     self.failUnless('Bob Døe' in browser.contents)
     self.failUnless('*****@*****.**' in browser.contents)
Exemple #24
0
    def test_add_edit_forms(self):
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        wt = getToolByName(portal, 'portal_workflow')
        portal.invokeFactory('Document', 'adoc', title='A document')
        wt.doActionFor(portal['adoc'], 'publish')
        title = portal['adoc'].Title()
        transaction.commit()
        browser = get_browser(self.layer['app'], loggedIn=True)
        url = portal.absolute_url() + \
            '/++contextportlets++plone.leftcolumn/+/' + \
            'intranett.policy.portlets.ContentHighlight'
        # Missing input
        browser.open(url)
        browser.getControl(name='form.buttons.add').click()
        self.assertEqual(browser.url, url)
        self.assertTrue('Required input is missing.' in browser.contents)
        # Add
        browser.getControl(name='form.widgets.portletTitle').value = 'A title'
        browser.getControl(
            name="form.widgets.item.widgets.query").value = title
        browser.getControl(name='form.buttons.add').click()
        browser.getControl(name='form.widgets.item:list').value = [title]
        browser.getControl(name='form.buttons.add').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
        # Cancel add
        browser.open(url)
        browser.getControl(name='form.buttons.cancel_add').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')

        url = portal.absolute_url() + \
            '/++contextportlets++plone.leftcolumn/' + \
            'content-highlight/edit'
        # Missing input
        browser.open(url)
        browser.getControl(name='form.widgets.portletTitle').value = ''
        browser.getControl(name='form.buttons.apply').click()
        self.assertEqual(browser.url, url)
        self.assertTrue('Required input is missing.' in browser.contents)
        # Edit without changes
        browser.getControl(name='form.widgets.portletTitle').value = 'A title'
        browser.getControl(name='form.buttons.apply').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
        # Edit with changes
        browser.open(url)
        browser.getControl(name='form.widgets.portletTitle').value = 'Title 2'
        browser.getControl(name='form.buttons.apply').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
        # Cancel edit
        browser.open(url)
        browser.getControl(name='form.buttons.cancel_add').click()
        self.assertEqual(browser.url, 'http://nohost/plone/@@manage-portlets')
Exemple #25
0
 def test_ttw_editing(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     browser.open(portal.absolute_url() + '/@@personal-information')
     browser.getControl(name='form.fullname').value = 'John Døe'
     browser.getControl(name='form.email').value = '*****@*****.**'
     browser.getControl(name='form.description').value = '<p>Kjære Python!</p>'
     browser.getControl(name='form.location').value = 'Tønsberg'
     browser.getControl(name='form.position').value = 'Øngønør'
     browser.getControl(name='form.department').value = 'Tåst'
     browser.getControl(name='form.actions.save').click()
     self.assert_(browser.url.endswith('@@personal-information'))
Exemple #26
0
 def test_ttw_editing(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     browser.open(portal.absolute_url() + '/@@personal-information')
     browser.getControl(name='form.fullname').value = 'John Døe'
     browser.getControl(name='form.email').value = '*****@*****.**'
     browser.getControl(
         name='form.description').value = '<p>Kjære Python!</p>'
     browser.getControl(name='form.location').value = 'Tønsberg'
     browser.getControl(name='form.position').value = 'Øngønør'
     browser.getControl(name='form.department').value = 'Tåst'
     browser.getControl(name='form.actions.save').click()
     self.assert_(browser.url.endswith('@@personal-information'))
Exemple #27
0
    def test_personal_frontpage(self):
        # As a normal user, I should be able to assign personal portraits
        portal = self.layer['portal']

        sm = getSecurityManager()
        self.assertEqual(sm.getUser().getId(), TEST_USER_ID)
        self.assertTrue(sm.checkPermission(
            'Portlets: Manage own portlets', portal))

        browser = get_browser(self.layer['app'])
        browser.handleErrors = False
        browser.open('http://nohost/plone/@@manage-dashboard')
        self.assertTrue('+/plone.portlet.static.Static' in browser.contents)
        self.assertTrue('+/portlets.News' in browser.contents)
Exemple #28
0
 def test_browser_default(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     mt = getToolByName(portal, 'portal_membership')
     member = mt.getAuthenticatedMember()
     member.setMemberProperties({
         'fullname': 'Bob Døe',
         'email': '*****@*****.**'
     })
     transaction.commit()
     browser.open(portal.absolute_url() + '/users/test_user_1_')
     self.failUnless('Bob Døe' in browser.contents)
     self.failUnless('*****@*****.**' in browser.contents)
    def test_projectroom_creator_can_add_participants(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom', title="ProjectRoom", description="ws")
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')
        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('participant1', 'secret', ['Member'], [])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.handleErrors = False
        browser.open(projectroom.absolute_url()+"/edit")
        browser.getControl(name="participants:list").value = ["participant1"]
        browser.getControl("Lagre").click()
        self.assertIn("participant1", projectroom.participants)
    def test_participants_shown_on_projectroom_home(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('participant1', 'secret', ['Member'], [])
        portal.portal_membership.getMemberById("participant1").setMemberProperties({"fullname": "Max Mustermann", })
        projectroom.participants = ('participant1', )
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.handleErrors = False
        browser.open(projectroom.absolute_url())
        self.assertTrue("Max Mustermann" in browser.contents)
Exemple #31
0
    def test_edit_frontpage(self):
        # As a Site Administrator we should be able to edit the frontpage
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Member', 'Site Administrator'])
        transaction.commit()

        sm = getSecurityManager()
        self.assertEqual(sm.getUser().getId(), TEST_USER_ID)
        self.assertTrue(sm.checkPermission('Portlets: Manage portlets', portal))

        browser = get_browser(self.layer['app'])
        browser.open('http://nohost/plone/')
        edit = browser.getLink('Redig\xc3\xa9r')
        edit.click()
        self.assertTrue(browser.url.endswith('manage-frontpage'))
        self.assert_('<ul class="contentViews"' in browser.contents)
        # and we can add multiple portlet types
        self.assertTrue('+/plone.portlet.static.Static' in browser.contents)
        self.assertTrue('+/portlets.News' in browser.contents)
Exemple #32
0
    def test_non_participants_can_see_public_projectroom_content(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        document_id = projectroom.invokeFactory("Document", "qwertyuiop")
        document = projectroom[document_id]
        wt.doActionFor(projectroom, 'publish')

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('nonparticipant', 'secret', ['Member'], [])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('nonparticipant', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        browser.open(document.absolute_url())
    def test_non_participants_can_see_public_projectroom_content(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        document_id = projectroom.invokeFactory("Document", "qwertyuiop")
        document = projectroom[document_id]
        wt.doActionFor(projectroom, 'publish')

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('nonparticipant', 'secret', ['Member'], [])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('nonparticipant', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        browser.open(document.absolute_url())
    def test_owner_of_protected_content_in_projectroom_cannot_see_it_when_not_a_participant(self):
        portal = self.layer['portal']
        folder = portal['test-folder']

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        document_id = projectroom.invokeFactory("Document", "qwertyuiop")
        document = projectroom[document_id]

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('nonparticipant', 'secret', ['Member'], [])
        document.manage_setLocalRoles('nonparticipant', ["Owner"])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('nonparticipant', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        with self.assertRaises(Unauthorized):
            browser.open(document.absolute_url())
Exemple #35
0
 def test_ttw_search(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     mt = getToolByName(portal, 'portal_membership')
     member = mt.getAuthenticatedMember()
     member.setMemberProperties({'fullname': 'Bob Døe',
                                 'phone': '12345',
                                 'mobile': '67890',
                                 'position': 'Øngønør',
                                 'department': 'Tøst',
                                 'location': 'Tønsberg',
                                 'email': '*****@*****.**'})
     transaction.commit()
     browser.open(portal.absolute_url())
     browser.getControl(name='SearchableText').value = 'Bob'
     browser.getForm(name='searchform').submit()
     self.failUnless('Bob Døe' in browser.contents)
     self.failUnless('Øngønør' in browser.contents)
     self.failUnless('Tøst' in browser.contents)
     self.failUnless('Øngønør, Tøst' in browser.contents)
Exemple #36
0
    def test_owner_of_protected_content_in_projectroom_cannot_see_it_when_not_a_participant(
            self):
        portal = self.layer['portal']
        folder = portal['test-folder']

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        document_id = projectroom.invokeFactory("Document", "qwertyuiop")
        document = projectroom[document_id]

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('nonparticipant', 'secret', ['Member'], [])
        document.manage_setLocalRoles('nonparticipant', ["Owner"])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('nonparticipant', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        with self.assertRaises(Unauthorized):
            browser.open(document.absolute_url())
Exemple #37
0
    def test_projectroom_creator_can_add_participants(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom',
                                              'projectroom',
                                              title="ProjectRoom",
                                              description="ws")
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')
        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('participant1', 'secret', ['Member'], [])
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.handleErrors = False
        browser.open(projectroom.absolute_url() + "/edit")
        browser.getControl(name="participants:list").value = ["participant1"]
        browser.getControl("Lagre").click()
        self.assertIn("participant1", projectroom.participants)
Exemple #38
0
    def test_participants_shown_on_projectroom_home(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('participant1', 'secret', ['Member'], [])
        portal.portal_membership.getMemberById(
            "participant1").setMemberProperties({
                "fullname": "Max Mustermann",
            })
        projectroom.participants = ('participant1', )
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=True)
        browser.handleErrors = False
        browser.open(projectroom.absolute_url())
        self.assertTrue("Max Mustermann" in browser.contents)
    def test_participants_can_add_content_in_projectroom(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('participant1', 'secret', ['Member'], [])
        projectroom.participants = ('participant1', )
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('participant1', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        browser.open(projectroom.absolute_url())
        browser.getLink(id="document").click()
        browser.getControl(name="title").value="Qwertyuiop"
        browser.getControl(name="text").value="qazxswedc"
        browser.getControl("Lagre").click()
Exemple #40
0
 def test_ttw_search(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = False
     portal = self.layer['portal']
     mt = getToolByName(portal, 'portal_membership')
     member = mt.getAuthenticatedMember()
     member.setMemberProperties({
         'fullname': 'Bob Døe',
         'phone': '12345',
         'mobile': '67890',
         'position': 'Øngønør',
         'department': 'Tøst',
         'location': 'Tønsberg',
         'email': '*****@*****.**'
     })
     transaction.commit()
     browser.open(portal.absolute_url())
     browser.getControl(name='SearchableText').value = 'Bob'
     browser.getForm(name='searchform').submit()
     self.failUnless('Bob Døe' in browser.contents)
     self.failUnless('Øngønør' in browser.contents)
     self.failUnless('Tøst' in browser.contents)
     self.failUnless('Øngønør, Tøst' in browser.contents)
Exemple #41
0
    def test_participants_can_add_content_in_projectroom(self):
        portal = self.layer['portal']
        folder = portal['test-folder']
        wt = getToolByName(portal, 'portal_workflow')

        projectroom_id = folder.invokeFactory('ProjectRoom', 'projectroom')
        projectroom = folder[projectroom_id]
        wt.doActionFor(projectroom, 'publish')

        acl_users = getToolByName(portal, 'acl_users')
        acl_users.userFolderAddUser('participant1', 'secret', ['Member'], [])
        projectroom.participants = ('participant1', )
        transaction.commit()

        browser = get_browser(self.layer['app'], loggedIn=False)
        auth = 'Basic %s:%s' % ('participant1', 'secret')
        browser.addHeader('Authorization', auth)
        browser.handleErrors = False
        browser.open(projectroom.absolute_url())
        browser.getLink(id="document").click()
        browser.getControl(name="title").value = "Qwertyuiop"
        browser.getControl(name="text").value = "qazxswedc"
        browser.getControl("Lagre").click()
Exemple #42
0
    def test_add_comment(self):
        portal = self.layer['portal']
        folder = portal['test-folder']

        folder.invokeFactory('Document', 'doc1')
        wftool = getToolByName(portal, 'portal_workflow')
        wftool.doActionFor(folder.doc1, 'publish')

        addUser = aq_get(portal, 'acl_users').userFolderAddUser
        addUser('member', 'secret', ['Member', 'Reader'], [])

        mtool = getToolByName(portal, 'portal_membership')
        mdata = mtool.getMemberById('member')
        mdata.setMemberProperties(dict(fullname='M\xc3\xa5mb\xc3\xb8r'))

        transaction.commit()

        # Get us a test browser with our new user
        browser = get_browser(self.layer['app'], loggedIn=False)
        browser.addHeader('Authorization', 'Basic member:secret')

        browser.open(folder.doc1.absolute_url())
        self.assertEquals(browser.url, 'http://nohost/plone/test-folder/doc1')

        # Fill in a comment
        text = browser.getControl(name='form.widgets.text')
        text.value = 'T\xc3\xa5st http://intranett.no'

        browser.getControl(name='form.buttons.comment').click()

        # The comment was added
        self.assert_('<a href="http://nohost/plone/author/member">'
                     'M\xc3\xa5mb\xc3\xb8r</a>' in browser.contents)

        # The link turned into a proper clickable one
        self.assert_('T&aring;st <a href="http://intranett.no" rel="nofollow">'
                     'http://intranett.no</a>' in browser.contents)
Exemple #43
0
    def test_add_comment(self):
        portal = self.layer['portal']
        folder = portal['test-folder']

        folder.invokeFactory('Document', 'doc1')
        wftool = getToolByName(portal, 'portal_workflow')
        wftool.doActionFor(folder.doc1, 'publish')

        addUser = aq_get(portal, 'acl_users').userFolderAddUser
        addUser('member', 'secret', ['Member', 'Reader'], [])

        mtool = getToolByName(portal, 'portal_membership')
        mdata = mtool.getMemberById('member')
        mdata.setMemberProperties(dict(fullname='M\xc3\xa5mb\xc3\xb8r'))

        transaction.commit()

        # Get us a test browser with our new user
        browser = get_browser(self.layer['app'], loggedIn=False)
        browser.addHeader('Authorization', 'Basic member:secret')

        browser.open(folder.doc1.absolute_url())
        self.assertEquals(browser.url, 'http://nohost/plone/test-folder/doc1')

        # Fill in a comment
        text = browser.getControl(name='form.widgets.text')
        text.value = 'T\xc3\xa5st http://intranett.no'

        browser.getControl(name='form.buttons.comment').click()

        # The comment was added
        self.assert_('<a href="http://nohost/plone/author/member">'
                     'M\xc3\xa5mb\xc3\xb8r</a>' in browser.contents)

        # The link turned into a proper clickable one
        self.assert_('T&aring;st <a href="http://intranett.no" rel="nofollow">'
                     'http://intranett.no</a>' in browser.contents)
Exemple #44
0
    def test_atvirusfile(self): # pragma: no cover
        # whee, evil skipping - we only want to run this on the actual
        # production system, so we don't force developers to have clamd on
        # their local machines
        if 'gentoo' not in platform.uname()[2]:
            return

        # Setup
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        portal.invokeFactory('Folder', 'virus-folder')
        setRoles(portal, TEST_USER_ID, ['Member'])
        transaction.commit()

        # Test if a virus-infected file gets caught by the validator
        browser = get_browser(self.layer['app'])
        browser.open(portal.absolute_url() + '/virus-folder')
        browser.getLink(url='createObject?type_name=File').click()
        control = browser.getControl(name='file_file')
        control.filename = 'virus.txt'
        control.value = StringIO(EICAR)
        browser.getControl(name='form.button.save').click()
        self.assertTrue('Validation failed, file is virus-infected.' in
            browser.contents)

        # And let's see if a clean file passes...
        browser.open(portal.absolute_url() + '/virus-folder')
        browser.getLink(url='createObject?type_name=File').click()
        control = browser.getControl(name='file_file')
        control.filename = 'nonvirus.txt'
        control.value = StringIO('Not a virus')
        browser.getControl(name='form.button.save').click()
        self.assertFalse('Validation failed, file is virus-infected.' in
            browser.contents)
        self.assertTrue(browser.url.endswith('/view'))
        self.assertTrue('Not a virus' in browser.contents)
Exemple #45
0
    def test_atvirusfile(self):  # pragma: no cover
        # whee, evil skipping - we only want to run this on the actual
        # production system, so we don't force developers to have clamd on
        # their local machines
        if 'gentoo' not in platform.uname()[2]:
            return

        # Setup
        portal = self.layer['portal']
        setRoles(portal, TEST_USER_ID, ['Manager'])
        portal.invokeFactory('Folder', 'virus-folder')
        setRoles(portal, TEST_USER_ID, ['Member'])
        transaction.commit()

        # Test if a virus-infected file gets caught by the validator
        browser = get_browser(self.layer['app'])
        browser.open(portal.absolute_url() + '/virus-folder')
        browser.getLink(url='createObject?type_name=File').click()
        control = browser.getControl(name='file_file')
        control.filename = 'virus.txt'
        control.value = StringIO(EICAR)
        browser.getControl(name='form.button.save').click()
        self.assertTrue(
            'Validation failed, file is virus-infected.' in browser.contents)

        # And let's see if a clean file passes...
        browser.open(portal.absolute_url() + '/virus-folder')
        browser.getLink(url='createObject?type_name=File').click()
        control = browser.getControl(name='file_file')
        control.filename = 'nonvirus.txt'
        control.value = StringIO('Not a virus')
        browser.getControl(name='form.button.save').click()
        self.assertFalse(
            'Validation failed, file is virus-infected.' in browser.contents)
        self.assertTrue(browser.url.endswith('/view'))
        self.assertTrue('Not a virus' in browser.contents)
Exemple #46
0
 def test_author_userid_redirects_to_users_id(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = True
     portal = self.layer['portal']
     browser.open(portal.absolute_url() + '/author/test_user_1_')
     self.assertEqual(browser.url, 'http://nohost/plone/users/test_user_1_')
Exemple #47
0
 def test_disallow(self):
     portal = self.layer['portal']
     browser = get_browser(self.layer['app'], loggedIn=False)
     # We should be allowed to view the page and see the disallow line
     browser.open(portal.absolute_url() + '/robots.txt')
     self.assert_("Disallow: /" in browser.contents)
Exemple #48
0
 def test_disallow(self):
     portal = self.layer['portal']
     browser = get_browser(self.layer['app'], loggedIn=False)
     # We should be allowed to view the page and see the disallow line
     browser.open(portal.absolute_url() + '/robots.txt')
     self.assert_("Disallow: /" in browser.contents)
Exemple #49
0
 def test_author_userid_redirects_to_users_id(self):
     browser = get_browser(self.layer['app'])
     browser.handleErrors = True
     portal = self.layer['portal']
     browser.open(portal.absolute_url() + '/author/test_user_1_')
     self.assertEqual(browser.url, 'http://nohost/plone/users/test_user_1_')