Fix UT failure due to horizon system-scope support
When horizon introduced the system-scope support in [1], the way to mock User object in the helper class was changed a bit. It now requires to setup User._is_system_user attribute properly. This commit mirrors such change in openstack_dashboard/test/helpers. [1] https://review.opendev.org/c/openstack/horizon/+/816368 Change-Id: I84c30705f6d2371c1bd74ba1ade4be4543ccf650
This commit is contained in:
parent
458e9b0519
commit
7729b75760
@ -179,18 +179,20 @@ class TestCase(horizon_helpers.TestCase):
|
|||||||
authorized_tenants=None, enabled=True, domain_id=None,
|
authorized_tenants=None, enabled=True, domain_id=None,
|
||||||
user_domain_name=None):
|
user_domain_name=None):
|
||||||
def get_user(request):
|
def get_user(request):
|
||||||
return user.User(id=id,
|
ret = user.User(id=id,
|
||||||
token=token,
|
token=token,
|
||||||
user=username,
|
user=username,
|
||||||
domain_id=domain_id,
|
domain_id=domain_id,
|
||||||
user_domain_name=user_domain_name,
|
user_domain_name=user_domain_name,
|
||||||
tenant_id=tenant_id,
|
tenant_id=tenant_id,
|
||||||
tenant_name=tenant_name,
|
tenant_name=tenant_name,
|
||||||
service_catalog=service_catalog,
|
service_catalog=service_catalog,
|
||||||
roles=roles,
|
roles=roles,
|
||||||
enabled=enabled,
|
enabled=enabled,
|
||||||
authorized_tenants=authorized_tenants,
|
authorized_tenants=authorized_tenants,
|
||||||
endpoint=settings.OPENSTACK_KEYSTONE_URL)
|
endpoint=settings.OPENSTACK_KEYSTONE_URL)
|
||||||
|
ret._is_system_user = False
|
||||||
|
return ret
|
||||||
utils.get_user = get_user
|
utils.get_user = get_user
|
||||||
|
|
||||||
def assertRedirectsNoFollow(self, response, expected_url):
|
def assertRedirectsNoFollow(self, response, expected_url):
|
||||||
|
Loading…
Reference in New Issue
Block a user