diff options
| author | Jose Castro Leon <jose.castro.leon@cern.ch> | 2019-03-14 12:33:51 +0000 |
|---|---|---|
| committer | Dean Troyer <dtroyer@gmail.com> | 2019-05-08 16:22:27 -0500 |
| commit | 04e03b2a1fe34046e2148d3c1d17b9053010c8af (patch) | |
| tree | 4a9220f0c7db50dedee6f93c17805eb46bb32512 /openstackclient/tests/unit/identity/v3/fakes.py | |
| parent | 70cf7ea1ced4724ebf11aa526c5c9cac983a835a (diff) | |
| download | python-openstackclient-04e03b2a1fe34046e2148d3c1d17b9053010c8af.tar.gz | |
Fix bug in endpoint group deletion
There is a typo in the endpoint group deletion, due to this you
can't remove endpoint groups once assigned. I am adding also the
unit tests to avoid this kind of issues in the future
Task: 30640
Story: 2005521
Change-Id: Ie938f2c9894bb39b4c0ed1f7aa3a6a751a303058
Diffstat (limited to 'openstackclient/tests/unit/identity/v3/fakes.py')
| -rw-r--r-- | openstackclient/tests/unit/identity/v3/fakes.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/openstackclient/tests/unit/identity/v3/fakes.py b/openstackclient/tests/unit/identity/v3/fakes.py index 27ee9fd0..e5727a6a 100644 --- a/openstackclient/tests/unit/identity/v3/fakes.py +++ b/openstackclient/tests/unit/identity/v3/fakes.py @@ -235,6 +235,10 @@ endpoint_group_filters = { 'service_id': service_id, 'region_id': endpoint_region, } +endpoint_group_filters_2 = { + 'region_id': endpoint_region, +} +endpoint_group_file_path = '/tmp/path/to/file' ENDPOINT_GROUP = { 'id': endpoint_group_id, @@ -1044,6 +1048,64 @@ class FakeEndpoint(object): return endpoint_filter +class FakeEndpointGroup(object): + """Fake one or more endpoint group.""" + + @staticmethod + def create_one_endpointgroup(attrs=None): + """Create a fake endpoint group. + + :param Dictionary attrs: + A dictionary with all attributes + :return: + A FakeResource object, with id, url, and so on + """ + + attrs = attrs or {} + + # set default attributes. + endpointgroup_info = { + 'id': 'endpoint-group-id-' + uuid.uuid4().hex, + 'name': 'endpoint-group-name-' + uuid.uuid4().hex, + 'filters': { + 'region': 'region-' + uuid.uuid4().hex, + 'service_id': 'service-id-' + uuid.uuid4().hex, + }, + 'description': 'endpoint-group-description-' + uuid.uuid4().hex, + 'links': 'links-' + uuid.uuid4().hex, + } + endpointgroup_info.update(attrs) + + endpoint = fakes.FakeResource(info=copy.deepcopy(endpointgroup_info), + loaded=True) + return endpoint + + @staticmethod + def create_one_endpointgroup_filter(attrs=None): + """Create a fake endpoint project relationship. + + :param Dictionary attrs: + A dictionary with all attributes of endpointgroup filter + :return: + A FakeResource object with project, endpointgroup and so on + """ + attrs = attrs or {} + + # Set default attribute + endpointgroup_filter_info = { + 'project': 'project-id-' + uuid.uuid4().hex, + 'endpointgroup': 'endpointgroup-id-' + uuid.uuid4().hex, + } + + # Overwrite default attributes if there are some attributes set + endpointgroup_filter_info.update(attrs) + + endpointgroup_filter = fakes.FakeModel( + copy.deepcopy(endpointgroup_filter_info)) + + return endpointgroup_filter + + class FakeService(object): """Fake one or more service.""" |
