Merge "Remove trailing '/' in swiching profile operations" into stable/ussuri

This commit is contained in:
Zuul 2021-10-25 18:40:47 +00:00 committed by Gerrit Code Review
commit 48c711cc05
2 changed files with 10 additions and 2 deletions

View File

@ -325,7 +325,7 @@ class TestSwitchingProfileTestCase(BaseTestResource):
mocked_resource.list()
test_client.assert_json_call(
'get', mocked_resource,
'https://1.2.3.4/api/v1/switching-profiles/'
'https://1.2.3.4/api/v1/switching-profiles'
'?include_system_owned=True',
data=None,
headers=self.default_headers())

View File

@ -285,9 +285,17 @@ class NsxLibSwitchingProfile(utils.NsxLibApiBase):
def uri_segment(self):
return 'switching-profiles'
def get_path(self, resource=None, query_params=None):
path = super().get_path(resource)
if query_params:
param_str = "&".join("%s=%s" % (k, v) for (k, v) in
query_params.items())
path = '%s?%s' % (path, param_str)
return path
def list(self):
return self.client.list(
self.get_path('?include_system_owned=True'))
self.get_path(query_params={'include_system_owned': True}))
def create(self, profile_type, display_name=None,
description=None, **api_args):