Exemplo n.º 1
0
    def setUp(self):
        self.root_page = Page.objects.get(id=2)

        self.hello_page = SimplePage(
            title="Hello world!",
            slug='hello-world',
            content="hello",
            live=False,
        )
        self.root_page.add_child(instance=self.hello_page)

        self.about_page = SimplePage(title="About",
                                     slug="about",
                                     content="hello")
        self.root_page.add_child(instance=self.about_page)

        User = get_user_model()
        self.administrator = User.objects.create_superuser(
            username='******',
            email='*****@*****.**',
            password='******')
        self.editor = User.objects.create_user(username='******',
                                               email='*****@*****.**',
                                               password='******')
        sub_editors = Group.objects.create(name='Sub editors')
        sub_editors.permissions.add(
            Permission.objects.get(content_type__app_label='wagtailadmin',
                                   codename='access_admin'))
        self.editor.groups.add(sub_editors)

        for permission_type in ['add', 'edit', 'publish']:
            GroupPagePermission.objects.create(group=sub_editors,
                                               page=self.hello_page,
                                               permission_type=permission_type)
    def setUp(self):
        self.user = get_user_model().objects.create_user(
            'Test User', '*****@*****.**', 'password')
        self.user.groups.add(Group.objects.get(name="Moderators"))
        self.client.force_login(self.user)

        self.image = get_image_model().objects.create(
            title='Test image', file=get_test_image_file())
    def setUp(self):
        self.home = Page.objects.get(slug='home')
        self.user = get_user_model().objects.create_user('Test User', '*****@*****.**', 'password')
        self.user.groups.add(Group.objects.get(name="Moderators"))
        self.client.force_login(self.user)

        try:
            self.journal_index = JournalIndexPage(title='Journal Index Test Page',
                                                  slug='journal-index-test-page',
                                                  body=json.dumps([]),
                                                  bottom_button_info=json.dumps([]))
            self.home.add_child(instance=self.journal_index)
        except:
            pass
    def setUp(self):
        self.home = Page.objects.get(slug='home')
        self.user = get_user_model().objects.create_user(
            'Test User', '*****@*****.**', 'password')
        self.user.groups.add(Group.objects.get(name="Moderators"))
        self.client.force_login(self.user)

        try:
            self.event_index = EventIndexPage(title='Event Index Test Page',
                                              body=json.dumps([{
                                                  u'type':
                                                  u'html',
                                                  u'value':
                                                  '<p>Testing!</p>'
                                              }]))
            self.home.add_child(instance=self.event_index)
        except:
            raise
Exemplo n.º 5
0
 def setUp(self):
     self.home = Page.objects.get(slug='home')
     self.user = get_user_model().objects.create_user(
         'Test User', '*****@*****.**', 'password')
     self.user.groups.add(Group.objects.get(name="Moderators"))
     self.client.force_login(self.user)