diff options
| author | Ankur Gupta <ankur.gupta@intel.com> | 2016-10-12 13:41:12 -0500 |
|---|---|---|
| committer | Ankur <ankur.gupta@intel.com> | 2016-12-04 17:31:12 +0000 |
| commit | 8c71a35eebb25a4930c7d0c2cc4cf0d57b1f6c72 (patch) | |
| tree | 1b872116719e9c12536e15e7374f28f1f4a5ea51 /openstackclient/tests | |
| parent | 70cb628278642e0e275c3e8d294bb73c17a97f5e (diff) | |
| download | python-openstackclient-8c71a35eebb25a4930c7d0c2cc4cf0d57b1f6c72.tar.gz | |
SDK Refactor: Prepare ip availability commands
Prepared the OSC "ip availability" commands for the SDK refactor.
See [1] for details.
[1] https://etherpad.openstack.org/p/osc-network-command-sdk-support
Change-Id: Ia22e9fafec0a91ba1b0f1ce825fcaf1d8cbbbf88
Partially-Implements: blueprint network-command-sdk-support
Diffstat (limited to 'openstackclient/tests')
| -rw-r--r-- | openstackclient/tests/unit/network/v2/fakes.py | 12 | ||||
| -rw-r--r-- | openstackclient/tests/unit/network/v2/test_ip_availability.py | 1 |
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 ed3579b7..527649b8 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( |
