summaryrefslogtreecommitdiff
path: root/openstackclient/tests/unit
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-12-08 17:40:58 +0000
committerGerrit Code Review <review@openstack.org>2016-12-08 17:40:58 +0000
commita9be7a6c731c4f590004812a3b3737ea266e8fc2 (patch)
treeee773240e42be382c783dbb1ab0cee411b993941 /openstackclient/tests/unit
parentbd69d55050e0e62a69ff60ddbc837f8d4043e9ce (diff)
parent8c71a35eebb25a4930c7d0c2cc4cf0d57b1f6c72 (diff)
downloadpython-openstackclient-a9be7a6c731c4f590004812a3b3737ea266e8fc2.tar.gz
Merge "SDK Refactor: Prepare ip availability commands"
Diffstat (limited to 'openstackclient/tests/unit')
-rw-r--r--openstackclient/tests/unit/network/v2/fakes.py12
-rw-r--r--openstackclient/tests/unit/network/v2/test_ip_availability.py1
2 files changed, 10 insertions, 3 deletions
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py
index c18511f7..97d07076 100644
--- a/openstackclient/tests/unit/network/v2/fakes.py
+++ b/openstackclient/tests/unit/network/v2/fakes.py
@@ -194,15 +194,18 @@ class FakeIPAvailability(object):
"""Fake one or more network ip availabilities."""
@staticmethod
- def create_one_ip_availability():
+ def create_one_ip_availability(attrs=None):
"""Create a fake list with ip availability stats of a network.
+ :param Dictionary attrs:
+ A dictionary with all attributes
:return:
A FakeResource object with network_name, network_id, etc.
"""
+ attrs = attrs or {}
# Set default attributes.
- network_ip_availability = {
+ network_ip_attrs = {
'network_id': 'network-id-' + uuid.uuid4().hex,
'network_name': 'network-name-' + uuid.uuid4().hex,
'tenant_id': '',
@@ -210,10 +213,13 @@ class FakeIPAvailability(object):
'total_ips': 254,
'used_ips': 6,
}
+ network_ip_attrs.update(attrs)
network_ip_availability = fakes.FakeResource(
- info=copy.deepcopy(network_ip_availability),
+ info=copy.deepcopy(network_ip_attrs),
loaded=True)
+ network_ip_availability.project_id = network_ip_attrs['tenant_id']
+
return network_ip_availability
@staticmethod
diff --git a/openstackclient/tests/unit/network/v2/test_ip_availability.py b/openstackclient/tests/unit/network/v2/test_ip_availability.py
index c929ab82..4bdbddc4 100644
--- a/openstackclient/tests/unit/network/v2/test_ip_availability.py
+++ b/openstackclient/tests/unit/network/v2/test_ip_availability.py
@@ -107,6 +107,7 @@ class TestListIPAvailability(TestIPAvailability):
columns, data = self.cmd.take_action(parsed_args)
filters = {'tenant_id': self.project.id,
+ 'project_id': self.project.id,
'ip_version': 4}
self.network.network_ip_availabilities.assert_called_once_with(