diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-04-13 02:06:59 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-04-13 02:06:59 +0000 |
| commit | 1819edf733d4a24e3fe0a8a998d72a0f4f0a8339 (patch) | |
| tree | 64a7a61d7e3cfdf52f516bda3f022566f71f1178 /openstackclient/tests/network/v2/fakes.py | |
| parent | 85c47b76fb7d2e085e1818377f725de9a508ac40 (diff) | |
| parent | b3649a54cd59dc069c76cbbcd876a1610aee00c0 (diff) | |
| download | python-openstackclient-1819edf733d4a24e3fe0a8a998d72a0f4f0a8339.tar.gz | |
Merge "Add --address-scope option "subnet pool create/set""
Diffstat (limited to 'openstackclient/tests/network/v2/fakes.py')
| -rw-r--r-- | openstackclient/tests/network/v2/fakes.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/openstackclient/tests/network/v2/fakes.py b/openstackclient/tests/network/v2/fakes.py index 815e677d..5fd7ea3b 100644 --- a/openstackclient/tests/network/v2/fakes.py +++ b/openstackclient/tests/network/v2/fakes.py @@ -71,6 +71,43 @@ class TestNetworkV2(utils.TestCommand): ) +class FakeAddressScope(object): + """Fake one or more address scopes.""" + + @staticmethod + def create_one_address_scope(attrs=None): + """Create a fake address scope. + + :param Dictionary attrs: + A dictionary with all attributes + :return: + A FakeResource object with name, id, etc. + """ + if attrs is None: + attrs = {} + + # Set default attributes. + address_scope_attrs = { + 'name': 'address-scope-name-' + uuid.uuid4().hex, + 'id': 'address-scope-id-' + uuid.uuid4().hex, + 'tenant_id': 'project-id-' + uuid.uuid4().hex, + 'shared': False, + 'ip_version': 4, + } + + # Overwrite default attributes. + address_scope_attrs.update(attrs) + + address_scope = fakes.FakeResource( + info=copy.deepcopy(address_scope_attrs), + loaded=True) + + # Set attributes with special mapping in OpenStack SDK. + address_scope.project_id = address_scope_attrs['tenant_id'] + + return address_scope + + class FakeAvailabilityZone(object): """Fake one or more network availability zones (AZs).""" |
