Remove trailing '/' in swiching profile operations

When querying switching profiles including system owned, there is
a trailing slash at the end of the URI.
This change removes this slash.

Change-Id: Iaa7d18fa8fdcd22c29baf2265259dfe843890213
This commit is contained in:
Salvatore Orlando 2021-10-20 06:44:27 -07:00
parent 4c6d36cfaa
commit fedb0ba5d3
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):