|
114 | 114 | },
|
115 | 115 | ]
|
116 | 116 |
|
117 |
| -# Record fixtures |
| 117 | + |
| 118 | +valid_ip_records_fields = [ |
| 119 | + dict( |
| 120 | + uuid="e3c5aeef-37b8-4332-ad9f-9d068f156dc2", |
| 121 | + measure_time=now, |
| 122 | + site_name="TEST-Site", |
| 123 | + user_id="a4519d7d-f60a-4908-9d63-7d9e17422188", |
| 124 | + group_id="03b6a6c4-cf2b-48b9-82f1-69c52b9f30af", |
| 125 | + user_dn="User 1 DN", |
| 126 | + fqan="VO 1 FQAN", |
| 127 | + ip_version=4, |
| 128 | + public_ip_count=10, |
| 129 | + compute_service="Fake Cloud Service", |
| 130 | + cloud_type=cloud_type, |
| 131 | + ), |
| 132 | + dict( |
| 133 | + uuid="5c50720e-a653-4d70-9b0e-d4388687fcbc", |
| 134 | + measure_time=now, |
| 135 | + site_name="TEST-Site", |
| 136 | + user_id="3391a44e-3728-478d-abde-b86c25356571", |
| 137 | + group_id="2dae43c4-1889-4e63-b172-d4e99381e30a", |
| 138 | + user_dn="User 2 DN", |
| 139 | + fqan="VO 2 FQAN", |
| 140 | + ip_version=6, |
| 141 | + public_ip_count=20, |
| 142 | + compute_service="Fake Cloud Service", |
| 143 | + cloud_type=cloud_type, |
| 144 | + ), |
| 145 | +] |
| 146 | + |
| 147 | +valid_ip_records_dict = [ |
| 148 | + { |
| 149 | + "CloudComputeService": "Fake Cloud Service", |
| 150 | + "FQAN": "VO 1 FQAN", |
| 151 | + "GlobalUserName": "User 1 DN", |
| 152 | + "IPCount": 10, |
| 153 | + "IPVersion": 4, |
| 154 | + "LocalGroup": "03b6a6c4-cf2b-48b9-82f1-69c52b9f30af", |
| 155 | + "LocalUser": "a4519d7d-f60a-4908-9d63-7d9e17422188", |
| 156 | + "MeasurementTime": 1685044746, |
| 157 | + "SiteName": "TEST-Site", |
| 158 | + "uuid": "e3c5aeef-37b8-4332-ad9f-9d068f156dc2", |
| 159 | + "CloudType": cloud_type, |
| 160 | + }, |
| 161 | + { |
| 162 | + "CloudComputeService": "Fake Cloud Service", |
| 163 | + "FQAN": "VO 1 FQAN", |
| 164 | + "GlobalUserName": "User 2 DN", |
| 165 | + "IPCount": 20, |
| 166 | + "IPVersion": 4, |
| 167 | + "LocalGroup": "2dae43c4-1889-4e63-b172-d4e99381e30a", |
| 168 | + "LocalUser": "3391a44e-3728-478d-abde-b86c25356571", |
| 169 | + "MeasurementTime": 1685044746, |
| 170 | + "SiteName": "TEST-Site", |
| 171 | + "uuid": "5c50720e-a653-4d70-9b0e-d4388687fcbc", |
| 172 | + "CloudType": cloud_type, |
| 173 | + }, |
| 174 | +] |
| 175 | + |
| 176 | +# Cloud Record fixtures |
118 | 177 |
|
119 | 178 |
|
120 | 179 | @pytest.fixture(scope="module")
|
@@ -160,6 +219,47 @@ def cloud_record_list(cloud_record, another_cloud_record):
|
160 | 219 | return [cloud_record, another_cloud_record]
|
161 | 220 |
|
162 | 221 |
|
| 222 | +# IP record fixtures |
| 223 | + |
| 224 | + |
| 225 | +@pytest.fixture(scope="module") |
| 226 | +def ip_record(): |
| 227 | + """Get a fixture for an IP record.""" |
| 228 | + record = caso.record.IPRecord(**valid_ip_records_fields[0]) |
| 229 | + return record |
| 230 | + |
| 231 | + |
| 232 | +@pytest.fixture(scope="module") |
| 233 | +def another_ip_record(): |
| 234 | + """Get another fixture for an IP record.""" |
| 235 | + record = caso.record.IPRecord(**valid_ip_records_fields[1]) |
| 236 | + return record |
| 237 | + |
| 238 | + |
| 239 | +@pytest.fixture(scope="module") |
| 240 | +def valid_ip_record(): |
| 241 | + """Get a fixture for a valid IP record as a dict.""" |
| 242 | + return valid_ip_records_dict[0] |
| 243 | + |
| 244 | + |
| 245 | +@pytest.fixture(scope="module") |
| 246 | +def valid_ip_records(): |
| 247 | + """Get a fixture for all IP records as a dict.""" |
| 248 | + return valid_ip_records_dict |
| 249 | + |
| 250 | + |
| 251 | +@pytest.fixture(scope="module") |
| 252 | +def another_valid_ip_record(): |
| 253 | + """Get another fixture for an IP record as a dict.""" |
| 254 | + return valid_ip_records_dict[0] |
| 255 | + |
| 256 | + |
| 257 | +@pytest.fixture(scope="module") |
| 258 | +def ip_record_list(ip_record, another_ip_record): |
| 259 | + """Get a fixture for a list of IP records.""" |
| 260 | + return [ip_record, another_ip_record] |
| 261 | + |
| 262 | + |
163 | 263 | # SSM entries
|
164 | 264 |
|
165 | 265 |
|
@@ -208,3 +308,33 @@ def expected_entries_cloud():
|
208 | 308 | ]
|
209 | 309 |
|
210 | 310 | return ssm_entries
|
| 311 | + |
| 312 | + |
| 313 | +@pytest.fixture |
| 314 | +def expected_entries_ip(): |
| 315 | + """Get a fixture for all IP entries.""" |
| 316 | + ssm_entries = [ |
| 317 | + '{"SiteName": "TEST-Site", ' |
| 318 | + '"CloudType": "caso/4.1.0.0rc1 (OpenStack)", ' |
| 319 | + '"CloudComputeService": "Fake Cloud Service", ' |
| 320 | + '"uuid": "e3c5aeef-37b8-4332-ad9f-9d068f156dc2", ' |
| 321 | + '"LocalUser": "a4519d7d-f60a-4908-9d63-7d9e17422188", ' |
| 322 | + '"GlobalUserName": "User 1 DN", ' |
| 323 | + '"LocalGroup": "03b6a6c4-cf2b-48b9-82f1-69c52b9f30af", ' |
| 324 | + '"FQAN": "VO 1 FQAN", ' |
| 325 | + '"MeasurementTime": 1685044746, ' |
| 326 | + '"IPVersion": 4, ' |
| 327 | + '"IPCount": 10}', |
| 328 | + '{"SiteName": "TEST-Site", ' |
| 329 | + '"CloudType": "caso/4.1.0.0rc1 (OpenStack)", ' |
| 330 | + '"CloudComputeService": "Fake Cloud Service", ' |
| 331 | + '"uuid": "5c50720e-a653-4d70-9b0e-d4388687fcbc", ' |
| 332 | + '"LocalUser": "3391a44e-3728-478d-abde-b86c25356571", ' |
| 333 | + '"GlobalUserName": "User 2 DN", ' |
| 334 | + '"LocalGroup": "2dae43c4-1889-4e63-b172-d4e99381e30a", ' |
| 335 | + '"FQAN": "VO 2 FQAN", ' |
| 336 | + '"MeasurementTime": 1685044746, ' |
| 337 | + '"IPVersion": 6, ' |
| 338 | + '"IPCount": 20}', |
| 339 | + ] |
| 340 | + return ssm_entries |
0 commit comments