|
235 | 235 | 'service_id': service_id, |
236 | 236 | 'region_id': endpoint_region, |
237 | 237 | } |
| 238 | +endpoint_group_filters_2 = { |
| 239 | + 'region_id': endpoint_region, |
| 240 | +} |
| 241 | +endpoint_group_file_path = '/tmp/path/to/file' |
238 | 242 |
|
239 | 243 | ENDPOINT_GROUP = { |
240 | 244 | 'id': endpoint_group_id, |
@@ -1044,6 +1048,64 @@ def create_one_endpoint_filter(attrs=None): |
1044 | 1048 | return endpoint_filter |
1045 | 1049 |
|
1046 | 1050 |
|
| 1051 | +class FakeEndpointGroup(object): |
| 1052 | + """Fake one or more endpoint group.""" |
| 1053 | + |
| 1054 | + @staticmethod |
| 1055 | + def create_one_endpointgroup(attrs=None): |
| 1056 | + """Create a fake endpoint group. |
| 1057 | +
|
| 1058 | + :param Dictionary attrs: |
| 1059 | + A dictionary with all attributes |
| 1060 | + :return: |
| 1061 | + A FakeResource object, with id, url, and so on |
| 1062 | + """ |
| 1063 | + |
| 1064 | + attrs = attrs or {} |
| 1065 | + |
| 1066 | + # set default attributes. |
| 1067 | + endpointgroup_info = { |
| 1068 | + 'id': 'endpoint-group-id-' + uuid.uuid4().hex, |
| 1069 | + 'name': 'endpoint-group-name-' + uuid.uuid4().hex, |
| 1070 | + 'filters': { |
| 1071 | + 'region': 'region-' + uuid.uuid4().hex, |
| 1072 | + 'service_id': 'service-id-' + uuid.uuid4().hex, |
| 1073 | + }, |
| 1074 | + 'description': 'endpoint-group-description-' + uuid.uuid4().hex, |
| 1075 | + 'links': 'links-' + uuid.uuid4().hex, |
| 1076 | + } |
| 1077 | + endpointgroup_info.update(attrs) |
| 1078 | + |
| 1079 | + endpoint = fakes.FakeResource(info=copy.deepcopy(endpointgroup_info), |
| 1080 | + loaded=True) |
| 1081 | + return endpoint |
| 1082 | + |
| 1083 | + @staticmethod |
| 1084 | + def create_one_endpointgroup_filter(attrs=None): |
| 1085 | + """Create a fake endpoint project relationship. |
| 1086 | +
|
| 1087 | + :param Dictionary attrs: |
| 1088 | + A dictionary with all attributes of endpointgroup filter |
| 1089 | + :return: |
| 1090 | + A FakeResource object with project, endpointgroup and so on |
| 1091 | + """ |
| 1092 | + attrs = attrs or {} |
| 1093 | + |
| 1094 | + # Set default attribute |
| 1095 | + endpointgroup_filter_info = { |
| 1096 | + 'project': 'project-id-' + uuid.uuid4().hex, |
| 1097 | + 'endpointgroup': 'endpointgroup-id-' + uuid.uuid4().hex, |
| 1098 | + } |
| 1099 | + |
| 1100 | + # Overwrite default attributes if there are some attributes set |
| 1101 | + endpointgroup_filter_info.update(attrs) |
| 1102 | + |
| 1103 | + endpointgroup_filter = fakes.FakeModel( |
| 1104 | + copy.deepcopy(endpointgroup_filter_info)) |
| 1105 | + |
| 1106 | + return endpointgroup_filter |
| 1107 | + |
| 1108 | + |
1047 | 1109 | class FakeService(object): |
1048 | 1110 | """Fake one or more service.""" |
1049 | 1111 |
|
|
0 commit comments