コード例 #1
0
ファイル: test_views.py プロジェクト: bqbn/addons-server
    def test_tools_developer_and_admin(self):
        # Make them a developer.
        user = self.login('admin', get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        response = self.client.get(self.url, follow=True)
        assert response.status_code == 200
        request = response.context['request']
        assert request.user.is_developer
        assert acl.action_allowed(request, amo.permissions.ADDONS_REVIEW)
        assert acl.action_allowed(request, amo.permissions.LOCALIZER)
        assert acl.action_allowed(request, amo.permissions.ANY_ADMIN)

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Reviewer Tools', reverse('reviewers.dashboard')),
            ('Admin Tools', reverse('zadmin.index')),
        ]
        check_links(
            expected, pq(response.content)('#aux-nav .tools a'), verify=False)
コード例 #2
0
ファイル: test_views.py プロジェクト: yashahmad/addons-server
    def test_tools_developer_and_admin(self):
        # Make them a developer.
        user = self.login('admin', get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        response = self.client.get(self.url, follow=True)
        assert response.status_code == 200
        request = response.context['request']
        assert request.user.is_developer
        assert acl.action_allowed(request, amo.permissions.ADDONS_REVIEW)
        assert acl.action_allowed(request, amo.permissions.LOCALIZER)
        assert acl.action_allowed(request, amo.permissions.ANY_ADMIN)

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.submit.agreement')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Reviewer Tools', reverse('reviewers.dashboard')),
            ('Admin Tools', reverse('zadmin.index')),
        ]
        check_links(expected,
                    pq(response.content)('#aux-nav .tools a'),
                    verify=False)
コード例 #3
0
    def test_tools_regular_user(self):
        self.login('regular')
        r = self.client.get(self.url, follow=True)
        eq_(r.context['request'].user.is_developer, False)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
コード例 #4
0
ファイル: test_views.py プロジェクト: yashahmad/addons-server
    def test_tools_regular_user(self):
        self.login('regular')
        r = self.client.get(self.url, follow=True)
        assert not r.context['request'].user.is_developer

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.submit.agreement')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'), verify=False)
コード例 #5
0
ファイル: test_views.py プロジェクト: Osmose/olympia
    def test_tools_regular_user(self):
        self.login("regular")
        r = self.client.get(self.url, follow=True)
        assert not r.context["request"].user.is_developer

        expected = [
            ("Tools", "#"),
            ("Submit a New Add-on", reverse("devhub.submit.agreement")),
            ("Submit a New Theme", reverse("devhub.themes.submit")),
            ("Developer Hub", reverse("devhub.index")),
            ("Manage API Keys", reverse("devhub.api_key")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"), verify=False)
コード例 #6
0
ファイル: test_views.py プロジェクト: tsl143/addons-server
    def test_tools_reviewer(self):
        self.login('reviewer')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        assert not request.user.is_developer
        assert acl.action_allowed(request, amo.permissions.ADDONS_REVIEW)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Reviewer Tools', reverse('reviewers.dashboard')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'), verify=False)
コード例 #7
0
    def test_tools_editor(self):
        self.login('editor')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.user.is_developer, False)
        eq_(acl.action_allowed(request, 'Addons', 'Review'), True)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
コード例 #8
0
ファイル: test_views.py プロジェクト: Osmose/olympia
    def test_tools_editor(self):
        self.login("editor")
        r = self.client.get(self.url, follow=True)
        request = r.context["request"]
        assert not request.user.is_developer
        assert acl.action_allowed(request, "Addons", "Review")

        expected = [
            ("Tools", "#"),
            ("Submit a New Add-on", reverse("devhub.submit.agreement")),
            ("Submit a New Theme", reverse("devhub.themes.submit")),
            ("Developer Hub", reverse("devhub.index")),
            ("Manage API Keys", reverse("devhub.api_key")),
            ("Editor Tools", reverse("editors.home")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"), verify=False)
コード例 #9
0
ファイル: test_views.py プロジェクト: yashahmad/addons-server
    def test_tools_reviewer(self):
        self.login('reviewer')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        assert not request.user.is_developer
        assert acl.action_allowed(request, amo.permissions.ADDONS_REVIEW)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.submit.agreement')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Reviewer Tools', reverse('reviewers.dashboard')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'), verify=False)
コード例 #10
0
    def test_tools_editor(self):
        self.login('editor')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        assert not request.user.is_developer
        assert acl.action_allowed(request, 'Addons', 'Review')

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
コード例 #11
0
ファイル: test_views.py プロジェクト: mstriemer/olympia
    def test_tools_admin(self):
        self.login('admin')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        assert not request.user.is_developer
        assert acl.action_allowed(request, 'Addons', 'Review')
        assert acl.action_allowed(request, 'Localizer', '%')
        assert acl.action_allowed(request, 'Admin', '%')

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Reviewer Tools', reverse('editors.home')),
            ('Admin Tools', reverse('zadmin.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'), verify=False)
コード例 #12
0
    def test_tools_developer_and_editor(self):
        # Make them a developer.
        user = self.login('editor', get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.user.is_developer, True)
        eq_(acl.action_allowed(request, 'Addons', 'Review'), True)

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
コード例 #13
0
ファイル: test_views.py プロジェクト: yashahmad/addons-server
    def test_tools_developer(self):
        # Make them a developer.
        user = self.login('regular', get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        group = Group.objects.create(name='Staff', rules='Admin:Tools')
        GroupUser.objects.create(group=group, user=user)

        r = self.client.get(self.url, follow=True)
        assert r.context['request'].user.is_developer

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.agreement')),
            ('Submit a New Theme', reverse('devhub.submit.agreement')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'), verify=False)
コード例 #14
0
ファイル: test_views.py プロジェクト: Osmose/olympia
    def test_tools_developer(self):
        # Make them a developer.
        user = self.login("regular", get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        group = Group.objects.create(name="Staff", rules="AdminTools:View")
        GroupUser.objects.create(group=group, user=user)

        r = self.client.get(self.url, follow=True)
        assert r.context["request"].user.is_developer

        expected = [
            ("Tools", "#"),
            ("Manage My Submissions", reverse("devhub.addons")),
            ("Submit a New Add-on", reverse("devhub.submit.agreement")),
            ("Submit a New Theme", reverse("devhub.themes.submit")),
            ("Developer Hub", reverse("devhub.index")),
            ("Manage API Keys", reverse("devhub.api_key")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"), verify=False)
コード例 #15
0
    def test_tools_developer_and_editor(self):
        # Make them a developer.
        user = self.login('editor', get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        assert request.user.is_developer
        assert acl.action_allowed(request, 'Addons', 'Review')

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
コード例 #16
0
    def test_tools_developer(self):
        # Make them a developer.
        user = self.login('regular', get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        group = Group.objects.create(name='Staff', rules='AdminTools:View')
        GroupUser.objects.create(group=group, user=user)

        r = self.client.get(self.url, follow=True)
        eq_(r.context['request'].user.is_developer, True)

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New Theme', reverse('devhub.themes.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Manage API Keys', reverse('devhub.api_key')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
コード例 #17
0
ファイル: test_views.py プロジェクト: Osmose/olympia
    def test_tools_developer_and_editor(self):
        # Make them a developer.
        user = self.login("editor", get=True)
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        r = self.client.get(self.url, follow=True)
        request = r.context["request"]
        assert request.user.is_developer
        assert acl.action_allowed(request, "Addons", "Review")

        expected = [
            ("Tools", "#"),
            ("Manage My Submissions", reverse("devhub.addons")),
            ("Submit a New Add-on", reverse("devhub.submit.agreement")),
            ("Submit a New Theme", reverse("devhub.themes.submit")),
            ("Developer Hub", reverse("devhub.index")),
            ("Manage API Keys", reverse("devhub.api_key")),
            ("Editor Tools", reverse("editors.home")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"), verify=False)