Skip to content

Commit

Permalink
Improves the BaseAdminView TestCase.
Browse files Browse the repository at this point in the history
Change-Id: I7786cac7dc8968d08083236e617a178e75d2e0b3
  • Loading branch information
gabrielhurley committed Mar 16, 2012
1 parent 3763816 commit baf6662
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions horizon/test.py
Expand Up @@ -222,18 +222,10 @@ class BaseAdminViewTests(TestCase):
A ``TestCase`` subclass which sets an active user with the "admin" role
for testing admin-only views and functionality.
"""
def setActiveUser(self, id=None, token=None, username=None, tenant_id=None,
service_catalog=None, tenant_name=None, roles=None,
authorized_tenants=None):
users.get_user_from_request = lambda x: \
users.User(id=self.user.id,
token=self.token.id,
user=self.user.name,
tenant_id=self.tenant.id,
service_catalog=self.service_catalog,
roles=[self.roles.admin._info],
authorized_tenants=None,
request=self.request)
def setActiveUser(self, *args, **kwargs):
if "roles" not in kwargs:
kwargs['roles'] = [self.roles.admin._info]
super(BaseAdminViewTests, self).setActiveUser(*args, **kwargs)


class APITestCase(TestCase):
Expand Down

0 comments on commit baf6662

Please sign in to comment.