Add API tests for non-accessible policies
Tests which dealt with creating a rule for a policy that the tenant has
no access to, or for a policy which does not even exist, were missing.
This patch adds them.
Partially-Implements: quantum-qos-api
Change-Id: I0a2679fa1ccfb7bae6083df9a71c6cb5205a21d9
diff --git a/neutron/tests/tempest/services/network/json/network_client.py b/neutron/tests/tempest/services/network/json/network_client.py
index c01c83c..38569a8 100644
--- a/neutron/tests/tempest/services/network/json/network_client.py
+++ b/neutron/tests/tempest/services/network/json/network_client.py
@@ -632,15 +632,16 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_qos_policy(self, name, description, shared):
+ def create_qos_policy(self, name, description, shared, tenant_id=None):
uri = '%s/qos/policies' % self.uri_prefix
- post_data = self.serialize(
- {'policy': {
+ post_data = {'policy': {
'name': name,
'description': description,
'shared': shared
- }})
- resp, body = self.post(uri, post_data)
+ }}
+ if tenant_id is not None:
+ post_data['policy']['tenant_id'] = tenant_id
+ resp, body = self.post(uri, self.serialize(post_data))
body = self.deserialize_single(body)
self.expected_success(201, resp.status)
return service_client.ResponseBody(resp, body)