예제 #1
0
    def test_json_with_subportals(self):
        t = self.t
        manage_addNySite(self.portal.info, id='subsite', title='subsite',
                         lang='en')

        self.req.form = {'node': 'info'}
        res = json.loads(self.portal.getNavigationSiteMap(self.req, subportals=True))
        self.assertEqual(len(res), 5)

        self.assertEqual(t(res[0]), 'info/accessibility')
        self.assertEqual(t(res[1]), 'info/cookie_policy')
        self.assertEqual(t(res[2]), 'info/contact')
        self.assertEqual(t(res[3]), 'info/sub_approved')
        self.assertEqual(t(res[4]), 'info/subsite')
        self.assertEqual(len(res[4]['children']), 1)
        self.assertEqual(t(res[4]['children'][0]), 'info/subsite/info')
        self.assertEqual(t(res[4]['children'][0]['children'][0]),
                         'info/subsite/info/accessibility')
        self.assertEqual(len(res[4]['children'][0]['children']), 3)

        self.req.form = {'node': 'info/subsite'}
        res = json.loads(self.portal.getNavigationSiteMap(self.req,
                                                          only_folders=True,
                                                          subportals=True))
        self.assertEqual(len(res), 1)
        self.assertEqual(t(res[0]), 'info/subsite/info')
예제 #2
0
    def afterSetUp(self):
        """ add a Naaya portal and create a Naaya Folder """
        self.root = app  #get Zope ROOT
        #create a default user in the users folder
        self.root.acl_users.userFolderAddUser("admin", "admin", ["Manager"],
                                              [])
        user = self.root.acl_users.getUserById('admin').__of__(
            self.root.acl_users)
        newSecurityManager(None, user)
        #add REQUEST variabiles
        self.root.REQUEST.AUTHENTICATED_USER = self.root.acl_users.getUser(
            'admin')
        #add Naaya portal and patch the Localizer
        manage_addNySite(self.root,
                         id='naaya-test',
                         title='Naaya test site',
                         default_content=True)
        self.portal = self.root._getOb('naaya-test')
        fixupTranslationServices(self.root, self.portal)

        #create NyFolder
        addNyFolder(self.portal,
                    title='test_folder',
                    id='folder_test',
                    lang='en')
예제 #3
0
 def test_getUsersRoles(self):
     acl_users = self.portal.acl_users
     acl_users._doAddUser('user1', 'user1', ['Contributor'], '',
                          'User name', 'User other name', '*****@*****.**')
     manage_addNySite(self.portal, id='subsite', title='subsite', lang='en')
     acl_users.manage_addUsersRoles('user1', roles=['Administrator'], location='info')
     acl_users.manage_addUsersRoles('user1', roles=['Manager'], location='subsite/info')
     users_roles = acl_users.getUsersRoles()
     self.assertTrue('user1' in users_roles)
     user1_roles = users_roles['user1']
     self.assertTrue((['Contributor'], '') in user1_roles)
     self.assertTrue((['Administrator'], 'info') in user1_roles)
     self.assertTrue((['Manager'], 'subsite/info') in user1_roles)
예제 #4
0
파일: ptkinit.py 프로젝트: eaudeweb/naaya
 def create_portal(self):
     #add a portal in ZODB
     try:
         print '\tCreating the portal object in ZODB...\n'
         self.root.manage_addProperty('management_page_charset', 'utf-8', 'string')
         add_error = manage_addNySite(self.root, id='portal', lang='en')
     except Exception, error:
         #failed to add the portal
         self.exit_script('\tFailed to add the portal object in ZODB: %s.\n' % str(error))
예제 #5
0
def portal_fixture(app):
    from Products.Naaya.NySite import manage_addNySite

    manage_addNySite(app, "portal", "Naaya Test Site")
    portal = app.portal

    portal.mail_address_from = "*****@*****.**"
    portal.administrator_email = "*****@*****.**"

    acl_users = portal.acl_users
    acl_users._doAddUser("test_user_1_", "secret", ["Manager"], "", "", "", "")
    acl_users._doAddUser(
        "contributor", "contributor", ["Contributor"], "", "Contributor", "Test", "*****@*****.**"
    )
    acl_users._doAddUser("reviewer", "reviewer", ["Reviewer"], "", "Reviewer", "Test", "*****@*****.**")
    acl_users._doAddUser("user1", "user1", ["Contributor"], "", "User", "One", "*****@*****.**")
    acl_users._doAddUser("user2", "user2", ["Contributor"], "", "User", "Two", "*****@*****.**")
    acl_users._doAddUser("user3", "user3", ["Contributor"], "", "User", "Three", "*****@*****.**")
예제 #6
0
def portal_fixture(app):
    from Products.Naaya.NySite import manage_addNySite
    manage_addNySite(app, 'portal', 'Naaya Test Site')
    portal = app.portal

    portal.mail_address_from = '*****@*****.**'
    portal.administrator_email = '*****@*****.**'

    acl_users = portal.acl_users
    acl_users._doAddUser('test_user_1_', 'secret', ['Manager'], '', '', '', '')
    acl_users._doAddUser('contributor', 'contributor', ['Contributor'], '',
                         'Contributor', 'Test', '*****@*****.**')
    acl_users._doAddUser('reviewer', 'reviewer', ['Reviewer'], '',
                         'Reviewer', 'Test', '*****@*****.**')
    acl_users._doAddUser('user1', 'user1', ['Contributor'], '',
                         'User', 'One', '*****@*****.**')
    acl_users._doAddUser('user2', 'user2', ['Contributor'], '',
                         'User', 'Two', '*****@*****.**')
    acl_users._doAddUser('user3', 'user3', ['Contributor'], '',
                         'User', 'Three', '*****@*****.**')
예제 #7
0
 def addPortal(self, portal_id):
     manage_addNySite(self.app, portal_id)
예제 #8
0
 def portal_fixture(self, app):
     """ Create and return a portal"""
     from Products.Naaya.NySite import manage_addNySite
     portal_id = 'portal'
     manage_addNySite(app, portal_id, 'Naaya Test Site')
     return portal_id
예제 #9
0
 def addPortal(self):
     from Products.Naaya.NySite import manage_addNySite
     manage_addNySite(self.app, 'portal', 'Naaya Test Site')
     self.portal = getattr(self.app, 'portal')
     self.portal.mail_address_from = '*****@*****.**'
예제 #10
0
 def setUp(self):
     super(NaayaTestCase, self).setUp()
     manage_addNySite(self.portal.info,
                      id='subsite', title='subsite', lang='en')
예제 #11
0
    def addPortal(self):
        from Products.Naaya.NySite import manage_addNySite

        manage_addNySite(self.app, "portal", "Naaya Test Site")
        self.portal = getattr(self.app, "portal")
        self.portal.mail_address_from = "*****@*****.**"
예제 #12
0
 def setUp(self):
     super(NaayaTestCase, self).setUp()
     manage_addNySite(self.portal.info,
                      id='subsite',
                      title='subsite',
                      lang='en')
예제 #13
0
 def portal_fixture(self, app):
     """ Create and return a portal"""
     from Products.Naaya.NySite import manage_addNySite
     portal_id = 'portal'
     manage_addNySite(app, portal_id, 'Naaya Test Site')
     return portal_id