Messing with admin access: Write tests and clean up code
This commit is contained in:
Родитель
a9808dbc89
Коммит
4d1565ea8f
|
@ -109,7 +109,7 @@ def global_settings(request):
|
|||
tools_links.append({'text': _('Localizer Tools'),
|
||||
'href': '/localizers'})
|
||||
if (acl.action_allowed(request, 'Admin', '%') or
|
||||
acl.action_allowed(request, 'Admin', 'View')):
|
||||
acl.action_allowed(request, 'AdminTools', 'View')):
|
||||
tools_links.append({'text': _('Admin Tools'),
|
||||
'href': reverse('zadmin.home')})
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ from pyquery import PyQuery as pq
|
|||
|
||||
import amo.tests
|
||||
from access import acl
|
||||
from access.models import Group, GroupUser
|
||||
from addons.models import Addon, AddonUser
|
||||
from amo.helpers import locale_url, urlparams
|
||||
from amo.pyquery_wrapper import PyQuery
|
||||
|
@ -113,6 +114,9 @@ class TestCommon(amo.tests.TestCase):
|
|||
user = self.login('regular')
|
||||
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)
|
||||
|
||||
|
|
|
@ -1864,6 +1864,7 @@ class TestPerms(amo.tests.TestCase):
|
|||
eq_(self.client.get(reverse('zadmin.settings')).status_code, 200)
|
||||
eq_(self.client.get(reverse('zadmin.flagged')).status_code, 200)
|
||||
eq_(self.client.get(reverse('zadmin.addon-search')).status_code, 200)
|
||||
eq_(self.client.get(reverse('zadmin.monthly_pick')).status_code, 200)
|
||||
eq_(self.client.get(
|
||||
reverse('zadmin.oauth-consumer-create')).status_code, 403)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче