Esempio n. 1
0
    def test_new_contributor(self, get_current):
        """Verify that interested contributors are added to group."""
        get_current.return_value.domain = 'su.mo.com'
        group_name = 'Registered as contributor'
        group(name=group_name, save=True)
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'password2': 'foobar22',
            'interested': 'yes'
        }
        response = self.client.post(reverse('users.register', locale='en-US'),
                                    data,
                                    follow=True)
        eq_(200, response.status_code)
        u = User.objects.get(username='******')
        eq_(group_name, u.groups.all()[0].name)

        # Activate user and verify email is sent.
        key = RegistrationProfile.objects.all()[0].activation_key
        url = reverse('users.activate', args=[u.id, key])
        response = self.client.get(url, follow=True)
        eq_(200, response.status_code)
        eq_(2, len(mail.outbox))
        assert mail.outbox[1].subject.find('Welcome to') == 0
        assert u.username in mail.outbox[1].body
Esempio n. 2
0
    def test_new_contributor(self, get_current):
        """Verify that interested contributors are added to group."""
        get_current.return_value.domain = 'su.mo.com'
        group_name = 'Registered as contributor'
        group(name=group_name, save=True)
        data = {
            'username': '******',
            'email': '*****@*****.**',
            'password': '******',
            'password2': 'foobar22',
            'interested': 'yes'}
        response = self.client.post(reverse('users.register', locale='en-US'),
                                    data, follow=True)
        eq_(200, response.status_code)
        u = User.objects.get(username='******')
        eq_(group_name, u.groups.all()[0].name)

        # Activate user and verify email is sent.
        key = RegistrationProfile.objects.all()[0].activation_key
        url = reverse('users.activate', args=[u.id, key])
        response = self.client.get(url, follow=True)
        eq_(200, response.status_code)
        eq_(2, len(mail.outbox))
        assert mail.outbox[1].subject.find('Welcome to') == 0
        assert u.username in mail.outbox[1].body
Esempio n. 3
0
    def test_right_group_profile(self):
        """Make sure we get the right group profile."""
        g1 = group(pk=100)
        g1.save()
        eq_(100, g1.pk)
        g2 = group(pk=101)
        g2.save()
        eq_(101, g2.pk)
        p = GroupProfile.objects.create(pk=100, group=g2, slug='foo')
        eq_(100, p.pk)

        eq_(group_link(g1), g1.name)
Esempio n. 4
0
    def test_right_group_profile(self):
        """Make sure we get the right group profile."""
        g1 = group(pk=100)
        g1.save()
        eq_(100, g1.pk)
        g2 = group(pk=101)
        g2.save()
        eq_(101, g2.pk)
        p = GroupProfile.objects.create(pk=100, group=g2, slug='foo')
        eq_(100, p.pk)

        eq_(group_link(g1), g1.name)
Esempio n. 5
0
 def setUp(self):
     super(AddRemoveLeaderTests, self).setUp()
     self.user = user(save=True)
     add_permission(self.user, GroupProfile, 'change_groupprofile')
     self.leader = user(save=True)
     self.group_profile = group_profile(group=group(save=True), save=True)
     self.client.login(username=self.user.username, password='******')
Esempio n. 6
0
    def test_delete_post_belongs_to_thread_and_forum(self):
        # Delete post action - post belongs to thread and thread
        # belongs to forum.
        f = forum(save=True)
        t = thread(forum=f, save=True)
        # Post belongs to a different forum and thread.
        p = forum_post(save=True)
        u = p.author

        # Give the user the permission to delete posts.
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.post_delete_forum',
                   content_type=ct, object_id=p.thread.forum_id, group=g,
                   save=True)
        permission(codename='forums_forum.post_delete_forum',
                   content_type=ct, object_id=f.id, group=g, save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')

        # Post isn't in the passed forum:
        r = get(self.client, 'forums.delete_post',
                args=[f.slug, p.thread.id, p.id])
        eq_(404, r.status_code)

        # Post isn't in the passed thread:
        r = get(self.client, 'forums.delete_post',
                args=[p.thread.forum.slug, t.id, p.id])
        eq_(404, r.status_code)
Esempio n. 7
0
    def test_move_thread(self):
        """Move a thread."""
        t = forum_post(save=True).thread
        f = forum(save=True)
        u = user(save=True)
        g = group(save=True)

        # Give the user permission to move threads between the two forums.
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.thread_move_forum',
                   content_type=ct,
                   object_id=f.id,
                   group=g,
                   save=True)
        permission(codename='forums_forum.thread_move_forum',
                   content_type=ct,
                   object_id=t.forum.id,
                   group=g,
                   save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')
        response = post(self.client,
                        'forums.move_thread', {'forum': f.id},
                        args=[t.forum.slug, t.id])
        eq_(200, response.status_code)
        t = Thread.uncached.get(pk=t.pk)
        eq_(f.id, t.forum.id)
Esempio n. 8
0
 def setUp(self):
     super(AddRemoveMemberTests, self).setUp()
     self.user = user(save=True)
     self.member = user(save=True)
     add_permission(self.user, GroupProfile, "change_groupprofile")
     self.group_profile = group_profile(group=group(save=True), save=True)
     self.client.login(username=self.user.username, password="******")
Esempio n. 9
0
 def setUp(self):
     super(AnnouncementModelTests, self).setUp()
     self.creator = user(save=True)
     profile(user=self.creator)
     self.group = group(save=True)
     self.locale = locale(locale='es', save=True)
     self.creator.groups.add(self.group)
Esempio n. 10
0
    def setUp(self):
        url = reverse('forums.threads', args=[u'test-forum'])
        self.context = {'request': RequestFactory().get(url)}

        self.group = group(save=True)

        # Set up forum_1
        f = self.forum_1 = forum(save=True)
        ct = ContentType.objects.get_for_model(self.forum_1)
        permission(codename='forums_forum.thread_edit_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
        permission(codename='forums_forum.post_edit_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
        permission(codename='forums_forum.post_delete_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
        permission(codename='forums_forum.thread_delete_forum',
                   content_type=ct, object_id=f.id, group=self.group,
                   save=True)
        permission(codename='forums_forum.thread_sticky_forum',
                   content_type=ct, object_id=f.id, group=self.group,
                   save=True)
        permission(codename='forums_forum.thread_move_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)

        # Set up forum_2
        f = self.forum_2 = forum(save=True)
        permission(codename='forums_forum.thread_move_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
Esempio n. 11
0
    def setUp(self):
        url = reverse('forums.threads', args=[u'test-forum'])
        self.context = {'request': test_utils.RequestFactory().get(url)}

        self.group = group(save=True)

        # Set up forum_1
        f = self.forum_1 = forum(save=True)
        ct = ContentType.objects.get_for_model(self.forum_1)
        permission(codename='forums_forum.thread_edit_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
        permission(codename='forums_forum.post_edit_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
        permission(codename='forums_forum.post_delete_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
        permission(codename='forums_forum.thread_delete_forum',
                   content_type=ct, object_id=f.id, group=self.group,
                   save=True)
        permission(codename='forums_forum.thread_sticky_forum',
                   content_type=ct, object_id=f.id, group=self.group,
                   save=True)
        permission(codename='forums_forum.thread_move_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)

        # Set up forum_2
        f = self.forum_2 = forum(save=True)
        permission(codename='forums_forum.thread_move_forum', content_type=ct,
                   object_id=f.id, group=self.group, save=True)
Esempio n. 12
0
    def test_edit_post_moderator(self):
        """Editing post as a moderator works."""
        p = forum_post(save=True)
        t = p.thread
        f = t.forum

        # Create the moderator group, give it the edit permission
        # and add a moderator.
        moderator_group = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.post_edit_forum',
                   content_type=ct,
                   object_id=f.id,
                   group=moderator_group,
                   save=True)
        moderator = user(save=True)
        moderator_group.user_set.add(moderator)

        self.client.login(username=moderator.username, password='******')

        r = post(self.client,
                 'forums.edit_post', {'content': 'More new content'},
                 args=[f.slug, t.id, p.id])
        eq_(200, r.status_code)

        edited_p = Post.uncached.get(pk=p.pk)
        eq_('More new content', edited_p.content)
Esempio n. 13
0
 def setUp(self):
     super(AnnouncementModelTests, self).setUp()
     self.creator = user(save=True)
     profile(user=self.creator)
     self.group = group(save=True)
     self.locale = locale(locale='es', save=True)
     self.creator.groups.add(self.group)
Esempio n. 14
0
    def test_forums_search_authorized_forums(self):
        """Only authorized people can search certain forums"""
        # Create two threads: one in a restricted forum and one not.
        forum1 = forum(name=u'ou812forum', save=True)
        thread1 = thread(forum=forum1, save=True)
        post(thread=thread1, content=u'audio', save=True)

        forum2 = restricted_forum(name=u'restrictedkeepout', save=True)
        thread2 = thread(forum=forum2, save=True)
        post(thread=thread2, content=u'audio restricted', save=True)

        self.refresh()

        # Do a search as an anonymous user but don't specify the
        # forums to filter on. Should only see one of the posts.
        response = self.client.get(reverse('search'), {
            'author': '',
            'created': '0',
            'created_date': '',
            'updated': '0',
            'updated_date': '',
            'sortby': '0',
            'a': '1',
            'w': '4',
            'q': 'audio',
            'format': 'json'
        })

        eq_(200, response.status_code)
        content = json.loads(response.content)
        eq_(content['total'], 1)

        # Do a search as an authorized user but don't specify the
        # forums to filter on. Should see both posts.
        u = user(save=True)
        g = group(save=True)
        g.user_set.add(u)
        ct = ContentType.objects.get_for_model(forum2)
        permission(codename='forums_forum.view_in_forum', content_type=ct,
                   object_id=forum2.id, group=g, save=True)

        self.client.login(username=u.username, password='******')
        response = self.client.get(reverse('search'), {
            'author': '',
            'created': '0',
            'created_date': '',
            'updated': '0',
            'updated_date': '',
            'sortby': '0',
            'a': '1',
            'w': '4',
            'q': 'audio',
            'format': 'json'
        })

        # Sees both results
        eq_(200, response.status_code)
        content = json.loads(response.content)
        eq_(content['total'], 2)
Esempio n. 15
0
    def test_forums_search_authorized_forums(self):
        """Only authorized people can search certain forums"""
        # Create two threads: one in a restricted forum and one not.
        forum1 = forum(name=u'ou812forum', save=True)
        thread1 = thread(forum=forum1, save=True)
        post(thread=thread1, content=u'audio', save=True)

        forum2 = restricted_forum(name=u'restrictedkeepout', save=True)
        thread2 = thread(forum=forum2, save=True)
        post(thread=thread2, content=u'audio restricted', save=True)

        self.refresh()

        # Do a search as an anonymous user but don't specify the
        # forums to filter on. Should only see one of the posts.
        response = self.client.get(reverse('search'), {
            'author': '',
            'created': '0',
            'created_date': '',
            'updated': '0',
            'updated_date': '',
            'sortby': '0',
            'a': '1',
            'w': '4',
            'q': 'audio',
            'format': 'json'
        })

        eq_(200, response.status_code)
        content = json.loads(response.content)
        eq_(content['total'], 1)

        # Do a search as an authorized user but don't specify the
        # forums to filter on. Should see both posts.
        u = user(save=True)
        g = group(save=True)
        g.user_set.add(u)
        ct = ContentType.objects.get_for_model(forum2)
        permission(codename='forums_forum.view_in_forum', content_type=ct,
                   object_id=forum2.id, group=g, save=True)

        self.client.login(username=u.username, password='******')
        response = self.client.get(reverse('search'), {
            'author': '',
            'created': '0',
            'created_date': '',
            'updated': '0',
            'updated_date': '',
            'sortby': '0',
            'a': '1',
            'w': '4',
            'q': 'audio',
            'format': 'json'
        })

        # Sees both results
        eq_(200, response.status_code)
        content = json.loads(response.content)
        eq_(content['total'], 2)
Esempio n. 16
0
 def test_group_link_with_profile(self):
     g = group()
     g.save()
     p = GroupProfile.objects.create(group=g, slug='foo')
     text = group_link(g)
     doc = pq(text)
     eq_(reverse('groups.profile', args=[p.slug]),
         doc('a')[0].attrib['href'])
     eq_(g.name, doc('a')[0].text)
Esempio n. 17
0
 def test_group_link_with_profile(self):
     g = group()
     g.save()
     p = GroupProfile.objects.create(group=g, slug='foo')
     text = group_link(g)
     doc = pq(text)
     eq_(reverse('groups.profile', args=[p.slug]),
         doc('a')[0].attrib['href'])
     eq_(g.name, doc('a')[0].text)
Esempio n. 18
0
 def test_group_avatar(self):
     g = group()
     g.save()
     p = GroupProfile.objects.create(group=g, slug='foo')
     url = group_avatar(p)
     eq_(settings.STATIC_URL + settings.DEFAULT_AVATAR, url)
     p.avatar = Mock()
     p.avatar.url = '/foo/bar'
     url = group_avatar(p)
     eq_('/foo/bar', url)
Esempio n. 19
0
 def test_group_avatar(self):
     g = group()
     g.save()
     p = GroupProfile.objects.create(group=g, slug='foo')
     url = group_avatar(p)
     eq_(settings.STATIC_URL + settings.DEFAULT_AVATAR, url)
     p.avatar = Mock()
     p.avatar.url = '/foo/bar'
     url = group_avatar(p)
     eq_('/foo/bar', url)
Esempio n. 20
0
    def _setup_announcement(self, visible_dates=True):
        g = group(save=True)
        u1 = user(save=True)
        u2 = user(save=True)
        u1.groups.add(g)
        u2.groups.add(g)
        # Create profiles for these users
        profile(user=u1)
        profile(user=u2)
        self.user = u2

        return announcement(creator=u1, group=g, save=True,
                            visible_dates=visible_dates)
Esempio n. 21
0
    def test_ga_custom_variable_on_admin_login(self):
        """After logging in, there should be a ga-push data attr on body."""
        user_ = profile().user

        # Add user to Administrators and so should be "Contributor - Admin":
        user_.groups.add(group(name='Administrators', save=True))
        response = self.client.post(reverse('users.login'),
                                    {'username': user_.username,
                                     'password': '******'},
                                    follow=True)
        eq_(200, response.status_code)
        doc = pq(response.content)
        assert '"Contributor - Admin"' in doc('body').attr('data-ga-push')
Esempio n. 22
0
    def test_ga_custom_variable_on_admin_login(self):
        """After logging in, there should be a ga-push data attr on body."""
        user_ = profile().user

        # Add user to Administrators and so should be "Contributor - Admin":
        user_.groups.add(group(name='Administrators', save=True))
        response = self.client.post(reverse('users.login'),
                                    {'username': user_.username,
                                     'password': '******'},
                                    follow=True)
        eq_(200, response.status_code)
        doc = pq(response.content)
        assert '"Contributor - Admin"' in doc('body').attr('data-ga-push')
Esempio n. 23
0
    def _setup_announcement(self, visible_dates=True):
        g = group(save=True)
        u1 = user(save=True)
        u2 = user(save=True)
        u1.groups.add(g)
        u2.groups.add(g)
        # Create profiles for these users
        profile(user=u1)
        profile(user=u2)
        self.user = u2

        return announcement(creator=u1,
                            group=g,
                            save=True,
                            visible_dates=visible_dates)
Esempio n. 24
0
    def test_edit_thread_moderator(self):
        """Editing post as a moderator works."""
        t = forum_post(save=True).thread
        f = t.forum
        u = user(save=True)
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.thread_edit_forum', content_type=ct,
                   object_id=f.id, group=g, save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')
        r = post(self.client, 'forums.edit_thread',
                 {'title': 'new title'}, args=[f.slug, t.id])
        eq_(200, r.status_code)
        edited_t = Thread.objects.get(id=t.id)
        eq_('new title', edited_t.title)
Esempio n. 25
0
    def test_delete_thread_belongs_to_forum(self):
        """Delete thread action - thread belongs to forum."""
        f = forum(save=True)
        t = thread(save=True)  # Thread belongs to a different forum
        u = user(save=True)

        # Give the user the permission to delete threads.
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.thread_delete_forum',
                   content_type=ct, object_id=f.id, group=g, save=True)
        permission(codename='forums_forum.thread_delete_forum',
                   content_type=ct, object_id=t.forum.id, group=g, save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')
        r = get(self.client, 'forums.delete_thread', args=[f.slug, t.id])
        eq_(404, r.status_code)
Esempio n. 26
0
    def test_discussion_forum_with_restricted_forums(self):
        """Tests who can see restricted forums in search form."""
        # This is a long test, but it saves us from doing the setup
        # twice.
        forum1 = forum(name=u'ou812forum', save=True)
        thread1 = thread(forum=forum1, title=u'audio 2', save=True)
        post(thread=thread1, save=True)

        forum2 = restricted_forum(name=u'restrictedkeepout', save=True)
        thread2 = thread(forum=forum2, title=u'audio 2', save=True)
        post(thread=thread2, save=True)

        self.refresh()

        # Get the Advanced Search Form as an anonymous user
        response = self.client.get(reverse('search.advanced'), {'a': '2'})
        eq_(200, response.status_code)

        # Regular forum should show up
        assert 'ou812forum' in response.content

        # Restricted forum should not show up
        assert 'restrictedkeepout' not in response.content

        u = user(save=True)
        g = group(save=True)
        g.user_set.add(u)
        ct = ContentType.objects.get_for_model(forum2)
        permission(codename='forums_forum.view_in_forum',
                   content_type=ct,
                   object_id=forum2.id,
                   group=g,
                   save=True)

        # Get the Advanced Search Form as a logged in user
        self.client.login(username=u.username, password='******')
        response = self.client.get(reverse('search.advanced'), {'a': '2'})
        eq_(200, response.status_code)

        # Both forums should show up for authorized user
        assert 'ou812forum' in response.content
        assert 'restrictedkeepout' in response.content
Esempio n. 27
0
    def test_edit_thread_moderator(self):
        """Editing post as a moderator works."""
        t = forum_post(save=True).thread
        f = t.forum
        u = user(save=True)
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.thread_edit_forum',
                   content_type=ct,
                   object_id=f.id,
                   group=g,
                   save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')
        r = post(self.client,
                 'forums.edit_thread', {'title': 'new title'},
                 args=[f.slug, t.id])
        eq_(200, r.status_code)
        edited_t = Thread.uncached.get(id=t.id)
        eq_('new title', edited_t.title)
Esempio n. 28
0
    def test_move_thread(self):
        """Move a thread."""
        t = forum_post(save=True).thread
        f = forum(save=True)
        u = user(save=True)
        g = group(save=True)

        # Give the user permission to move threads between the two forums.
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.thread_move_forum', content_type=ct,
                   object_id=f.id, group=g, save=True)
        permission(codename='forums_forum.thread_move_forum', content_type=ct,
                   object_id=t.forum.id, group=g, save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')
        response = post(self.client, 'forums.move_thread',
                        {'forum': f.id},
                        args=[t.forum.slug, t.id])
        eq_(200, response.status_code)
        t = Thread.objects.get(pk=t.pk)
        eq_(f.id, t.forum.id)
    def test_discussion_forum_with_restricted_forums(self):
        """Tests who can see restricted forums in search form."""
        # This is a long test, but it saves us from doing the setup
        # twice.
        forum1 = forum(name=u'ou812forum', save=True)
        thread1 = thread(forum=forum1, title=u'audio 2', save=True)
        post(thread=thread1, save=True)

        forum2 = restricted_forum(name=u'restrictedkeepout', save=True)
        thread2 = thread(forum=forum2, title=u'audio 2', save=True)
        post(thread=thread2, save=True)

        self.refresh()

        # Get the Advanced Search Form as an anonymous user
        response = self.client.get(reverse('search.advanced'), {'a': '2'})
        eq_(200, response.status_code)

        # Regular forum should show up
        assert 'ou812forum' in response.content

        # Restricted forum should not show up
        assert 'restrictedkeepout' not in response.content

        u = user(save=True)
        g = group(save=True)
        g.user_set.add(u)
        ct = ContentType.objects.get_for_model(forum2)
        permission(codename='forums_forum.view_in_forum', content_type=ct,
                   object_id=forum2.id, group=g, save=True)

        # Get the Advanced Search Form as a logged in user
        self.client.login(username=u.username, password='******')
        response = self.client.get(reverse('search.advanced'), {'a': '2'})
        eq_(200, response.status_code)

        # Both forums should show up for authorized user
        assert 'ou812forum' in response.content
        assert 'restrictedkeepout' in response.content
Esempio n. 30
0
    def test_edit_post_moderator(self):
        """Editing post as a moderator works."""
        p = forum_post(save=True)
        t = p.thread
        f = t.forum

        # Create the moderator group, give it the edit permission
        # and add a moderator.
        moderator_group = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.post_edit_forum', content_type=ct,
                   object_id=f.id, group=moderator_group, save=True)
        moderator = user(save=True)
        moderator_group.user_set.add(moderator)

        self.client.login(username=moderator.username, password='******')

        r = post(self.client, 'forums.edit_post',
                 {'content': 'More new content'}, args=[f.slug, t.id, p.id])
        eq_(200, r.status_code)

        edited_p = Post.uncached.get(pk=p.pk)
        eq_('More new content', edited_p.content)
Esempio n. 31
0
    def test_delete_post_belongs_to_thread_and_forum(self):
        # Delete post action - post belongs to thread and thread
        # belongs to forum.
        f = forum(save=True)
        t = thread(forum=f, save=True)
        # Post belongs to a different forum and thread.
        p = forum_post(save=True)
        u = p.author

        # Give the user the permission to delete posts.
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.post_delete_forum',
                   content_type=ct,
                   object_id=p.thread.forum_id,
                   group=g,
                   save=True)
        permission(codename='forums_forum.post_delete_forum',
                   content_type=ct,
                   object_id=f.id,
                   group=g,
                   save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')

        # Post isn't in the passed forum:
        r = get(self.client,
                'forums.delete_post',
                args=[f.slug, p.thread.id, p.id])
        eq_(404, r.status_code)

        # Post isn't in the passed thread:
        r = get(self.client,
                'forums.delete_post',
                args=[p.thread.forum.slug, t.id, p.id])
        eq_(404, r.status_code)
Esempio n. 32
0
    def test_delete_thread_belongs_to_forum(self):
        """Delete thread action - thread belongs to forum."""
        f = forum(save=True)
        t = thread(save=True)  # Thread belongs to a different forum
        u = user(save=True)

        # Give the user the permission to delete threads.
        g = group(save=True)
        ct = ContentType.objects.get_for_model(f)
        permission(codename='forums_forum.thread_delete_forum',
                   content_type=ct,
                   object_id=f.id,
                   group=g,
                   save=True)
        permission(codename='forums_forum.thread_delete_forum',
                   content_type=ct,
                   object_id=t.forum.id,
                   group=g,
                   save=True)
        g.user_set.add(u)

        self.client.login(username=u.username, password='******')
        r = get(self.client, 'forums.delete_thread', args=[f.slug, t.id])
        eq_(404, r.status_code)
Esempio n. 33
0
 def setUp(self):
     super(JoinContributorsTests, self).setUp()
     self.user = user(save=True)
     self.client.login(username=self.user.username, password='******')
     group(name='Contributors', save=True)
Esempio n. 34
0
 def setUp(self):
     super(EditGroupProfileTests, self).setUp()
     self.user = user(save=True)
     self.group_profile = group_profile(group=group(save=True), save=True)
     self.client.login(username=self.user.username, password='******')
Esempio n. 35
0
 def test_group_link_no_profile(self):
     g = group()
     text = group_link(g)
     eq_(g.name, text)
Esempio n. 36
0
 def setUp(self):
     self.u = user(save=True)
     self.client.login(username=self.u.username, password='******')
     group(name=CONTRIBUTOR_GROUP, save=True)
     super(MakeContributorTests, self).setUp()
Esempio n. 37
0
 def test_group_link_no_profile(self):
     g = group()
     text = group_link(g)
     eq_(g.name, text)
Esempio n. 38
0
 def setUp(self):
     super(KarmaTitleHelperTests, self).setUp()
     self.user = user(save=True)
     self.group = group(name='group', save=True)
     self.user.groups.add(self.group)
Esempio n. 39
0
 def setUp(self):
     self.u = user(save=True)
     self.client.login(username=self.u.username, password='******')
     group(name=CONTRIBUTOR_GROUP, save=True)
     super(MakeContributorTests, self).setUp()