diff options
| author | Jenkins <jenkins@review.openstack.org> | 2017-03-21 03:32:47 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-03-21 03:32:47 +0000 |
| commit | efc570dae223a46de4a77d0ed03648998ca37eab (patch) | |
| tree | ce4256b8b938ac2c2f835a2f8595bc249588071b /openstackclient/tests/unit/network/v2/fakes.py | |
| parent | 49e866174f2e24ce996cdb588c38b5b08daed5a0 (diff) | |
| parent | 7ef1e9ea96ef15b63304a6bccaf30f8c269f2b76 (diff) | |
| download | python-openstackclient-efc570dae223a46de4a77d0ed03648998ca37eab.tar.gz | |
Merge "OSC Network Flavor Profile"
Diffstat (limited to 'openstackclient/tests/unit/network/v2/fakes.py')
| -rw-r--r-- | openstackclient/tests/unit/network/v2/fakes.py | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/network/v2/fakes.py b/openstackclient/tests/unit/network/v2/fakes.py index e0ee05b4..fed4b788 100644 --- a/openstackclient/tests/unit/network/v2/fakes.py +++ b/openstackclient/tests/unit/network/v2/fakes.py @@ -769,6 +769,53 @@ class FakeNetworkRBAC(object): return mock.Mock(side_effect=rbac_policies) +class FakeNetworkFlavorProfile(object): + """Fake network flavor profile.""" + + @staticmethod + def create_one_service_profile(attrs=None): + """Create flavor profile.""" + attrs = attrs or {} + + flavor_profile_attrs = { + 'id': 'flavor-profile-id' + uuid.uuid4().hex, + 'description': 'flavor-profile-description-' + uuid.uuid4().hex, + 'tenant_id': 'project-id-' + uuid.uuid4().hex, + 'driver': 'driver-' + uuid.uuid4().hex, + 'metainfo': 'metainfo-' + uuid.uuid4().hex, + 'enabled': True + } + + flavor_profile_attrs.update(attrs) + + flavor_profile = fakes.FakeResource( + info=copy.deepcopy(flavor_profile_attrs), + loaded=True) + + flavor_profile.project_id = flavor_profile_attrs['tenant_id'] + flavor_profile.is_enabled = flavor_profile_attrs['enabled'] + + return flavor_profile + + @staticmethod + def create_service_profile(attrs=None, count=2): + """Create multiple flavor profiles.""" + + flavor_profiles = [] + for i in range(0, count): + flavor_profiles.append(FakeNetworkFlavorProfile. + create_one_service_profile(attrs)) + return flavor_profiles + + @staticmethod + def get_service_profile(flavor_profile=None, count=2): + """Get a list of flavor profiles.""" + if flavor_profile is None: + flavor_profile = (FakeNetworkFlavorProfile. + create_service_profile(count)) + return mock.Mock(side_effect=flavor_profile) + + class FakeNetworkQosPolicy(object): """Fake one or more QoS policies.""" |
