def setUp(self):
        """
        Create some pages to play with.
        """
        self.publicPage = tests.create_page({'name': 'permitPublicView',
                                             'shortcut': 'permitPublicView'})

        self.loginrequiredPage = tests.create_page({'name': 'disablePublicView',
                                                    'shortcut': 'disablePublicView'})
        self.loginrequiredPage.permitViewPublic = False
        self.loginrequiredPage.save()
Exemplo n.º 2
0
    def setUp(self):
        """
        Create a clean page table.
        """
        Page.objects.all().delete() # Delete all existins pages

        # Create one page
        self.test_page = tests.create_page(
            name = "blog",
            shortcut = "blog",
            content = "{% lucidTag blog %}",
        )
    def setUp(self):
        self.login("superuser") # login client as superuser

        Page.objects.all().delete() # Delete all existins pages

        self.template = tests.create_template(
            content = (
                "<!-- page_messages -->\n"
                "{{ PAGE.content }}"
            )
        )

        # Create one page
        self.test_page = tests.create_page(
            content = "{% lucidTag unittest_plugin %}",
            template=self.template
        )

        self.base_url = "/%s/%s" % ( # Used with self.assertPluginAccess()
            settings.COMMAND_URL_PREFIX, self.test_page.id
        )
        self.command = "%s/%s/%%s/" % (self.base_url, TEST_PLUGIN_NAME)
        self.test_url = self.test_page.get_absolute_url()
    def setUp(self):
        """
        Create some pages, groups and users to play with.
        """
        # groups
        group_names = ('groupA','groupB')
        groups = {}
        for name in group_names:
            (groups[name],dummy) = self.Group.objects.get_or_create(name=name)
            groups[name].save()
        # users
        USERS = {
            "A": {
                    "username": "******",
                    "email": "*****@*****.**",
                    "password": "******",
                    "is_staff": False,
                    "is_superuser": False,
                    },
            "B": {
                    "username": "******",
                    "email": "*****@*****.**",
                    "password": "******",
                    "is_staff": False,
                    "is_superuser": False,
                    },
            }
        for usertype, userdata in USERS.iteritems():
            u = tests.create_user(**userdata)
            u.groups.add(groups['group'+usertype])
            u.save
        self.USERS = USERS

        self.groupPage = tests.create_page({'name':'PageForGroupA',"shortcut":"PageForGroupA"})
        self.groupPage.permitViewGroup = groups['groupA']
        self.groupPage.save()