Example #1
0
    def test_tools_developer_and_admin(self):
        # Make them a developer.
        user = self.login('admin')
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.amo_user.is_developer, True)
        eq_(acl.action_allowed(request, 'Editors', '%'), True)
        eq_(acl.action_allowed(request, 'Localizer', '%'), True)
        eq_(acl.action_allowed(request, 'Admin', '%'), True)

        expected = [
            ('Tools', '#'),
            ('Manage My Add-ons', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Manage My Apps', reverse('devhub.apps')),
            ('Submit a New App', reverse('devhub.submit_apps.1')),
            ('Submit a New Persona', reverse('devhub.personas.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
            ('Localizer Tools', '/localizers'),
            ('Admin Tools', reverse('zadmin.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #2
0
    def test_tools_developer_and_admin(self):
        # Make them a developer.
        user = self.login('admin')
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.amo_user.is_developer, True)
        eq_(acl.action_allowed(request, 'Editors', '%'), True)
        eq_(acl.action_allowed(request, 'Localizer', '%'), True)
        eq_(acl.action_allowed(request, 'Admin', '%'), True)

        expected = [
            ('Tools', '#'),
            ('Manage My Add-ons', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Manage My Apps', reverse('devhub.apps')),
            ('Submit a New App', reverse('devhub.submit_apps.1')),
            ('Submit a New Persona', reverse('devhub.personas.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
            ('Localizer Tools', '/localizers'),
            ('Admin Tools', reverse('zadmin.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #3
0
 def test_restricted_results(self):
     r = self.client.get(self.url)
     eq_(r.status_code, 200)
     links = pq(r.content)("#addon-queue tbody")("tr td:nth-of-type(2) a")
     apps = Webapp.objects.pending().order_by("created")
     expected = [
         (unicode(apps[0].name), self.review_url(apps[0], "1")),
         (unicode(apps[1].name), self.review_url(apps[1], "2")),
     ]
     check_links(expected, links, verify=False)
Example #4
0
 def test_template_links(self):
     r = self.client.get(self.url)
     eq_(r.status_code, 200)
     links = pq(r.content)('#addon-queue tbody')('tr td:nth-of-type(2) a')
     apps = Webapp.objects.pending().order_by('created')
     expected = [
         (unicode(apps[0].name), self.review_url(apps[0])),
         (unicode(apps[1].name), self.review_url(apps[1])),
     ]
     check_links(expected, links, verify=False)
Example #5
0
 def test_personas_subnav(self):
     doc = pq(self.client.get(reverse('home')).content)
     base_url = reverse('browse.personas')
     expected = [
         ('Personas', base_url),
         ('Most Popular', urlparams(base_url, sort='popular')),
         ('Top Rated', urlparams(base_url, sort='rating')),
         ('Newest', urlparams(base_url, sort='created')),
     ]
     check_links(expected, doc('#site-nav #personas a'))
Example #6
0
 def test_template_links(self):
     r = self.client.get(self.url)
     eq_(r.status_code, 200)
     links = pq(r.content)('#addon-queue tbody')('tr td:nth-of-type(2) a')
     apps = Webapp.objects.pending().order_by('created')
     expected = [
         (unicode(apps[0].name), self.review_url(apps[0], '1')),
         (unicode(apps[1].name), self.review_url(apps[1], '2')),
     ]
     check_links(expected, links, verify=False)
Example #7
0
 def test_personas_subnav(self):
     doc = pq(self.client.get(reverse("home")).content)
     base_url = reverse("browse.personas")
     expected = [
         ("Personas", base_url),
         ("Most Popular", urlparams(base_url, sort="popular")),
         ("Top Rated", urlparams(base_url, sort="rating")),
         ("Newest", urlparams(base_url, sort="created")),
     ]
     check_links(expected, doc("#site-nav #personas a"))
Example #8
0
    def test_tools_regular_user(self):
        self.login('regular')
        r = self.client.get(self.url, follow=True)
        eq_(r.context['request'].amo_user.is_developer, False)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Developer Hub', reverse('devhub.index')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #9
0
    def test_tools_regular_user(self):
        self.login("regular")
        r = self.client.get(self.url, follow=True)
        eq_(r.context["request"].amo_user.is_developer, False)

        expected = [
            ("Tools", "#"),
            ("Submit a New Add-on", reverse("devhub.submit.1")),
            ("Developer Hub", reverse("devhub.index")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"))
Example #10
0
    def test_tools_regular_user(self):
        self.login('regular')
        r = self.client.get(self.url, follow=True)
        eq_(r.context['request'].amo_user.is_developer, False)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Developer Hub', reverse('devhub.index')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #11
0
 def test_template_links(self):
     r = self.client.get(self.url)
     eq_(r.status_code, 200)
     links = pq(r.content)('#addon-queue tbody')('tr td:nth-of-type(2) a')
     apps = [rq.addon for rq in
             RereviewQueue.objects.all().order_by('created')]
     expected = [
         (unicode(apps[0].name), self.review_url(apps[0], '1')),
         (unicode(apps[1].name), self.review_url(apps[1], '2')),
         (unicode(apps[2].name), self.review_url(apps[2], '3')),
     ]
     check_links(expected, links, verify=False)
Example #12
0
    def test_tools_editor(self):
        self.login("editor")
        r = self.client.get(self.url, follow=True)
        request = r.context["request"]
        eq_(request.amo_user.is_developer, False)
        eq_(acl.action_allowed(request, "Addons", "Review"), True)

        expected = [
            ("Tools", "#"),
            ("Submit a New Add-on", reverse("devhub.submit.1")),
            ("Developer Hub", reverse("devhub.index")),
            ("Editor Tools", reverse("editors.home")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"))
Example #13
0
    def test_tools_editor(self):
        self.login('editor')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.amo_user.is_developer, False)
        eq_(acl.action_allowed(request, 'Addons', 'Review'), True)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #14
0
    def test_tools_editor(self):
        self.login('editor')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.amo_user.is_developer, False)
        eq_(acl.action_allowed(request, 'Addons', 'Review'), True)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #15
0
    def test_tools_developer(self):
        # Make them a developer.
        user = self.login('regular')
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

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

        expected = [
            ('Tools', '#'),
            ('Manage My Add-ons', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Manage My Apps', reverse('devhub.apps')),
            ('Submit a New App', reverse('devhub.submit_apps.1')),
            ('Submit a New Persona', reverse('devhub.personas.submit')),
            ('Developer Hub', reverse('devhub.index')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #16
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.amo_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")),
            ("Developer Hub", reverse("devhub.index")),
            ("Editor Tools", reverse("editors.home")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"))
Example #17
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.amo_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')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #18
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"].amo_user.is_developer, True)

        expected = [
            ("Tools", "#"),
            ("Manage My Submissions", reverse("devhub.addons")),
            ("Submit a New Add-on", reverse("devhub.submit.1")),
            ("Developer Hub", reverse("devhub.index")),
        ]
        check_links(expected, pq(r.content)("#aux-nav .tools a"))
Example #19
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'].amo_user.is_developer, True)

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Developer Hub', reverse('devhub.index')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #20
0
    def test_tools_developer(self):
        # Make them a developer.
        user = self.login('regular')
        AddonUser.objects.create(user=user, addon=Addon.objects.all()[0])

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

        expected = [
            ('Tools', '#'),
            ('Manage My Add-ons', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Manage My Apps', reverse('devhub.apps')),
            ('Submit a New App', reverse('devhub.submit_apps.1')),
            ('Submit a New Persona', reverse('devhub.personas.submit')),
            ('Developer Hub', reverse('devhub.index')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #21
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'].amo_user.is_developer, True)

        expected = [
            ('Tools', '#'),
            ('Manage My Submissions', reverse('devhub.addons')),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Developer Hub', reverse('devhub.index')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #22
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.amo_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')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #23
0
    def test_tools_admin(self):
        self.login('admin')
        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)
        eq_(acl.action_allowed(request, 'Localizer', '%'), True)
        eq_(acl.action_allowed(request, 'Admin', '%'), 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')),
            ('Admin Tools', reverse('zadmin.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #24
0
    def test_tools_admin(self):
        self.login('admin')
        r = self.client.get(self.url, follow=True)
        request = r.context['request']
        eq_(request.amo_user.is_developer, False)
        eq_(acl.action_allowed(request, 'Editors', '%'), True)
        eq_(acl.action_allowed(request, 'Localizer', '%'), True)
        eq_(acl.action_allowed(request, 'Admin', '%'), True)

        expected = [
            ('Tools', '#'),
            ('Submit a New Add-on', reverse('devhub.submit.1')),
            ('Submit a New App', reverse('devhub.submit_apps.1')),
            ('Submit a New Persona', reverse('devhub.personas.submit')),
            ('Developer Hub', reverse('devhub.index')),
            ('Editor Tools', reverse('editors.home')),
            ('Localizer Tools', '/localizers'),
            ('Admin Tools', reverse('zadmin.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))
Example #25
0
    def test_tools_admin(self):
        self.login('admin')
        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)
        eq_(acl.action_allowed(request, 'Localizer', '%'), True)
        eq_(acl.action_allowed(request, 'Admin', '%'), 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')),
            ('Localizer Tools', '/localizers'),
            ('Admin Tools', reverse('zadmin.home')),
        ]
        check_links(expected, pq(r.content)('#aux-nav .tools a'))