commit 597e22f055d69940ab08a2d7eaffaabdcd602eec Author: wangzhiguang Date: Thu Sep 3 10:28:59 2020 +0800 add delete multiple device profile by names api test add delete multiple device profile api test in cyborg module Change-Id: Iffb33968088f6117a9b91bafd253f46637fba2d3 diff --git a/cyborg_tempest_plugin/services/cyborg_rest_client.py b/cyborg_tempest_plugin/services/cyborg_rest_client.py index f7ebf78..f9788c9 100644 --- a/cyborg_tempest_plugin/services/cyborg_rest_client.py +++ b/cyborg_tempest_plugin/services/cyborg_rest_client.py @@ -48,6 +48,12 @@ class CyborgRestClient(rest_client.RestClient): resp, body = self.get(self.DP_URL) return self._response_helper(resp, body) + def delete_multiple_device_profile_by_names(self, *device_profile_names): + names = ','.join(device_profile_names) + url = self.DP_URL + "?value=" + names + resp, body = self.delete(url) + return self._response_helper(resp, body) + def get_auth_provider(credentials, scope='project'): default_params = { diff --git a/cyborg_tempest_plugin/tests/api/test_device_profile.py b/cyborg_tempest_plugin/tests/api/test_device_profile.py index f08ae8e..cbe6160 100644 --- a/cyborg_tempest_plugin/tests/api/test_device_profile.py +++ b/cyborg_tempest_plugin/tests/api/test_device_profile.py @@ -36,6 +36,30 @@ class TestDeviceProfileController(base.BaseAPITest): self.addCleanup(self.os_admin.cyborg_client.delete_device_profile, dp[0]['name']) + def test_delete_multiple_device_profile(self): + dp_one = [{ + "name": "afaas_example_1", + "groups": [ + {"resources:FPGA": "1", + "trait:CUSTOM_FPGA_1": "required", + "trait:CUSTOM_FUNCTION_ID_3AFB": "required", + } + ] + }] + dp_two = [{ + "name": "afaas_example_2", + "groups": [ + {"resources:FPGA": "1", + "trait:CUSTOM_FPGA_1": "required", + "trait:CUSTOM_FUNCTION_ID_3AFB": "required", + } + ] + }] + self.os_admin.cyborg_client.create_device_profile(dp_one) + self.os_admin.cyborg_client.create_device_profile(dp_two) + self.os_admin.cyborg_client.delete_multiple_device_profile_by_names( + dp_one[0]['name'], dp_two[0]['name']) + @classmethod def resource_cleanup(cls): super(TestDeviceProfileController, cls).resource_cleanup()