@@ 358-374 (lines=17) @@ | ||
355 | get_circuits.assert_called_with(archived="false", metadata={}) |
|
356 | assert response.json() == expected_result |
|
357 | ||
358 | async def test_list_with_archived_circuits_archived(self): |
|
359 | """Test if list circuits only archived circuits.""" |
|
360 | circuits = { |
|
361 | 'circuits': |
|
362 | { |
|
363 | "1": {"name": "circuit_1", "archived": True}, |
|
364 | } |
|
365 | } |
|
366 | get_circuits = self.napp.mongo_controller.get_circuits |
|
367 | get_circuits.return_value = circuits |
|
368 | ||
369 | url = f"{self.base_endpoint}/v2/evc/?archived=true&metadata.a=1" |
|
370 | response = await self.api_client.get(url) |
|
371 | get_circuits.assert_called_with(archived="true", |
|
372 | metadata={"metadata.a": "1"}) |
|
373 | expected_result = {"1": circuits["circuits"]["1"]} |
|
374 | assert response.json() == expected_result |
|
375 | ||
376 | async def test_list_with_archived_circuits_all(self): |
|
377 | """Test if list circuits return all circuits.""" |
|
@@ 343-356 (lines=14) @@ | ||
340 | expected_result = circuits["circuits"] |
|
341 | assert response.json() == expected_result |
|
342 | ||
343 | async def test_list_with_circuits_stored(self): |
|
344 | """Test if list circuits return all circuits stored.""" |
|
345 | circuits = { |
|
346 | 'circuits': |
|
347 | {"1": {"name": "circuit_1"}, "2": {"name": "circuit_2"}} |
|
348 | } |
|
349 | get_circuits = self.napp.mongo_controller.get_circuits |
|
350 | get_circuits.return_value = circuits |
|
351 | ||
352 | url = f"{self.base_endpoint}/v2/evc/" |
|
353 | response = await self.api_client.get(url) |
|
354 | expected_result = circuits["circuits"] |
|
355 | get_circuits.assert_called_with(archived="false", metadata={}) |
|
356 | assert response.json() == expected_result |
|
357 | ||
358 | async def test_list_with_archived_circuits_archived(self): |
|
359 | """Test if list circuits only archived circuits.""" |