예제 #1
0
    def test_create_publish_copy(self):
        # create new page to copy
        page = create_page("page", "nav_playground.html")

        page = publish_page(page, self.user_master)

        with self.login_user_context(self.user_master):
            copied_page = page.copy_page(self.master_page, page.site, True, True)

        #self.check_published_page_attributes(page)
        copied_page = publish_page(copied_page, self.user_master)
예제 #2
0
    def test_create_publish_copy(self):
        # create new page to copy
        page = create_page("page", "nav_playground.html")

        page = publish_page(page, self.user_master)

        with self.login_user_context(self.user_master):
            copied_page = page.copy_page(self.master_page, page.site, True,
                                         True)

        #self.check_published_page_attributes(page)
        copied_page = publish_page(copied_page, self.user_master)
예제 #3
0
    def test_create_copy_publish(self):
        # create new page to copy
        page = create_page("page", "nav_playground.html")

        with self.login_user_context(self.user_master):
            copied_page = page.copy_page(self.home_page, page.site, True, True)

        page = publish_page(copied_page, self.user_master)
예제 #4
0
    def test_create_copy_publish(self):
        # create new page to copy
        page = create_page("page", "nav_playground.html")

        with self.login_user_context(self.user_master):
            copied_page = page.copy_page(self.home_page, page.site, True, True)

        page = publish_page(copied_page, self.user_master)
예제 #5
0
    def test_same_order(self):
        # create 4 pages
        slugs = []
        for i in range(0, 4):
            page = create_page("page", "nav_playground.html")
            slug = page.slug
            slugs.append(slug)

        # approve last 2 pages in reverse order
        for slug in reversed(slugs[2:]):
            page = publish_page(page, self.user_master)
예제 #6
0
    def test_same_order(self):
        # create 4 pages
        slugs = []
        for i in range(0, 4):
            page = create_page("page", "nav_playground.html")
            slug = page.slug
            slugs.append(slug)

        # approve last 2 pages in reverse order
        for slug in reversed(slugs[2:]):
            page = publish_page(page, self.user_master)
예제 #7
0
    def setUp(self):
        # create super user
        self.user_super = User(username="******", is_staff=True, is_active=True,
            is_superuser=True)
        self.user_super.set_password("super")
        self.user_super.save()
        # create staff user
        self.user_staff = User(username="******", is_staff=True, is_active=True)
        self.user_staff.set_password("staff")
        self.user_staff.save()

        with self.login_user_context(self.user_super):

            self._home_page = create_page("home", "nav_playground.html",
                                         created_by=self.user_super)

            # master page & master user


            # create master user
            master = User(username="******", email="*****@*****.**", is_staff=True, is_active=True)
            master.set_password('master')
            master.save()
            self._master_page = create_page("home", "nav_playground.html",
                                         created_by=master)

            self.user_master = master
            # create non global, non staff user
            self.user_non_global = User(username="******", is_active=True)
            self.user_non_global.set_password("nonglobal")
            self.user_non_global.save()

            # slave page & slave user

            self._slave_page = create_page("slave-home", "nav_playground.html",
                              created_by=self.user_super)

            slave = User(username='******', email='*****@*****.**', is_staff=True)
            slave.set_password('slave')
            slave.save()

            self.user_slave = slave

            assign_user_to_page(self.slave_page, self.user_slave, grant_all=True)

            # create page_b
            page_b = create_page("pageB", "nav_playground.html", created_by=self.user_super)
            # Normal user
            normal = User(username='******', email='*****@*****.**', is_active=True)
            normal.set_password('normal')
            normal.save()
            self.user_normal = normal
            # it's allowed for the normal user to view the page
            assign_user_to_page(page_b, self.user_normal, can_view=True)
            self.user_normal = self.reload(self.user_normal)
            # create page_a - sample page from master

            page_a = create_page("pageA", "nav_playground.html",
                                 created_by=self.user_super)
            assign_user_to_page(page_a, self.user_master,
                can_add=True, can_change=True, can_delete=True, can_publish=True)

            # publish after creating all get_query_set
            publish_page(self.home_page, self.user_super)

            publish_page(self.master_page, self.user_super)

            self.page_b = publish_page(page_b, self.user_super)
예제 #8
0
    def setUp(self):
        # create super user
        self.user_super = User(username="******", is_staff=True, is_active=True,
            is_superuser=True)
        self.user_super.set_password("super")
        self.user_super.save()
        with self.login_user_context(self.user_super):

            self._home_page = create_page("home", "nav_playground.html",
                                         created_by=self.user_super)


            # create master user
            master = User.objects.create(username="******", email="*****@*****.**", password="******")
            self.user_master = master
            # master page & master user
            self._master_page = create_page("master", "nav_playground.html", created_by=master)

            # assign master user under home page
            assign_user_to_page(self.home_page, self.user_master,
                                grant_all=True)

            # and to master page
            assign_user_to_page(self.master_page, self.user_master, grant_all=True)

            # slave page & slave user

            self._slave_page = create_page("slave-home", "nav_playground.html",
                              created_by=self.user_super)
            slave = User(username='******', email='*****@*****.**', is_staff=True, is_active=True)
            slave.set_password('slave')
            slave.save()
            self.user_slave = slave
            assign_user_to_page(self.slave_page, self.user_slave, grant_all=True)

            # create page_a - sample page from master

            page_a = create_page("pageA", "nav_playground.html",
                                 created_by=self.user_super)
            assign_user_to_page(page_a, self.user_master,
                can_add=True, can_change=True, can_delete=True, can_publish=True)

            # publish after creating all get_query_set
            publish_page(self.home_page, self.user_super)
            publish_page(self.master_page, self.user_super)

        with self.login_user_context(self.user_slave):

            # all of them are under moderation...
            self._pa = create_page("pa", "nav_playground.html")
            self._pb = create_page("pb", "nav_playground.html")
            self._pc = create_page("pc", "nav_playground.html")

            self._pd = create_page("pd", "nav_playground.html")
            self._pe = create_page("pe", "nav_playground.html")

            self._pf = create_page("pf", "nav_playground.html")
            self._pg = create_page("pg", "nav_playground.html")
            self._ph = create_page("ph", "nav_playground.html")

            # login as master for approval
            publish_page(self.slave_page, self.user_master)

            # publish and approve them all
            publish_page(self.pa, self.user_master)
            publish_page(self.pb, self.user_master)
            publish_page(self.pc, self.user_master)
            publish_page(self.pd, self.user_master)
            publish_page(self.pe, self.user_master)
            publish_page(self.pf, self.user_master)
            publish_page(self.pg, self.user_master)
            publish_page(self.ph, self.user_master)
예제 #9
0
    def setUp(self):
        # create super user
        self.user_super = User(username="******",
                               is_staff=True,
                               is_active=True,
                               is_superuser=True)
        self.user_super.set_password("super")
        self.user_super.save()
        # create staff user
        self.user_staff = User(username="******", is_staff=True, is_active=True)
        self.user_staff.set_password("staff")
        self.user_staff.save()

        with self.login_user_context(self.user_super):

            self._home_page = create_page("home",
                                          "nav_playground.html",
                                          created_by=self.user_super)

            # master page & master user

            # create master user
            master = User(username="******",
                          email="*****@*****.**",
                          is_staff=True,
                          is_active=True)
            master.set_password('master')
            master.save()
            self._master_page = create_page("home",
                                            "nav_playground.html",
                                            created_by=master)

            self.user_master = master
            # create non global, non staff user
            self.user_non_global = User(username="******", is_active=True)
            self.user_non_global.set_password("nonglobal")
            self.user_non_global.save()

            # slave page & slave user

            self._slave_page = create_page("slave-home",
                                           "nav_playground.html",
                                           created_by=self.user_super)

            slave = User(username='******',
                         email='*****@*****.**',
                         is_staff=True)
            slave.set_password('slave')
            slave.save()

            self.user_slave = slave

            assign_user_to_page(self.slave_page,
                                self.user_slave,
                                grant_all=True)

            # create page_b
            page_b = create_page("pageB",
                                 "nav_playground.html",
                                 created_by=self.user_super)
            # Normal user
            normal = User(username='******',
                          email='*****@*****.**',
                          is_active=True)
            normal.set_password('normal')
            normal.save()
            self.user_normal = normal
            # it's allowed for the normal user to view the page
            assign_user_to_page(page_b, self.user_normal, can_view=True)
            self.user_normal = self.reload(self.user_normal)
            # create page_a - sample page from master

            page_a = create_page("pageA",
                                 "nav_playground.html",
                                 created_by=self.user_super)
            assign_user_to_page(page_a,
                                self.user_master,
                                can_add=True,
                                can_change=True,
                                can_delete=True,
                                can_publish=True)

            # publish after creating all get_query_set
            publish_page(self.home_page, self.user_super)

            publish_page(self.master_page, self.user_super)

            self.page_b = publish_page(page_b, self.user_super)
예제 #10
0
    def setUp(self):
        # create super user
        self.user_super = User(username="******",
                               is_staff=True,
                               is_active=True,
                               is_superuser=True)
        self.user_super.set_password("super")
        self.user_super.save()
        with self.login_user_context(self.user_super):

            self._home_page = create_page("home",
                                          "nav_playground.html",
                                          created_by=self.user_super)

            # create master user
            master = User.objects.create(username="******",
                                         email="*****@*****.**",
                                         password="******")
            self.user_master = master
            # master page & master user
            self._master_page = create_page("master",
                                            "nav_playground.html",
                                            created_by=master)

            # assign master user under home page
            assign_user_to_page(self.home_page,
                                self.user_master,
                                grant_all=True)

            # and to master page
            assign_user_to_page(self.master_page,
                                self.user_master,
                                grant_all=True)

            # slave page & slave user

            self._slave_page = create_page("slave-home",
                                           "nav_playground.html",
                                           created_by=self.user_super)
            slave = User(username='******',
                         email='*****@*****.**',
                         is_staff=True,
                         is_active=True)
            slave.set_password('slave')
            slave.save()
            self.user_slave = slave
            assign_user_to_page(self.slave_page,
                                self.user_slave,
                                grant_all=True)

            # create page_a - sample page from master

            page_a = create_page("pageA",
                                 "nav_playground.html",
                                 created_by=self.user_super)
            assign_user_to_page(page_a,
                                self.user_master,
                                can_add=True,
                                can_change=True,
                                can_delete=True,
                                can_publish=True)

            # publish after creating all get_query_set
            publish_page(self.home_page, self.user_super)
            publish_page(self.master_page, self.user_super)

        with self.login_user_context(self.user_slave):

            # all of them are under moderation...
            self._pa = create_page("pa", "nav_playground.html")
            self._pb = create_page("pb", "nav_playground.html")
            self._pc = create_page("pc", "nav_playground.html")

            self._pd = create_page("pd", "nav_playground.html")
            self._pe = create_page("pe", "nav_playground.html")

            self._pf = create_page("pf", "nav_playground.html")
            self._pg = create_page("pg", "nav_playground.html")
            self._ph = create_page("ph", "nav_playground.html")

            # login as master for approval
            publish_page(self.slave_page, self.user_master)

            # publish and approve them all
            publish_page(self.pa, self.user_master)
            publish_page(self.pb, self.user_master)
            publish_page(self.pc, self.user_master)
            publish_page(self.pd, self.user_master)
            publish_page(self.pe, self.user_master)
            publish_page(self.pf, self.user_master)
            publish_page(self.pg, self.user_master)
            publish_page(self.ph, self.user_master)