@@ 394-410 (lines=17) @@ | ||
391 | get_circuits.assert_called_with(archived="false", metadata={}) |
|
392 | assert response.json() == expected_result |
|
393 | ||
394 | async def test_list_with_archived_circuits_archived(self): |
|
395 | """Test if list circuits only archived circuits.""" |
|
396 | circuits = { |
|
397 | 'circuits': |
|
398 | { |
|
399 | "1": {"name": "circuit_1", "archived": True}, |
|
400 | } |
|
401 | } |
|
402 | get_circuits = self.napp.mongo_controller.get_circuits |
|
403 | get_circuits.return_value = circuits |
|
404 | ||
405 | url = f"{self.base_endpoint}/v2/evc/?archived=true&metadata.a=1" |
|
406 | response = await self.api_client.get(url) |
|
407 | get_circuits.assert_called_with(archived="true", |
|
408 | metadata={"metadata.a": "1"}) |
|
409 | expected_result = {"1": circuits["circuits"]["1"]} |
|
410 | assert response.json() == expected_result |
|
411 | ||
412 | async def test_list_with_archived_circuits_all(self): |
|
413 | """Test if list circuits return all circuits.""" |
|
@@ 379-392 (lines=14) @@ | ||
376 | expected_result = circuits["circuits"] |
|
377 | assert response.json() == expected_result |
|
378 | ||
379 | async def test_list_with_circuits_stored(self): |
|
380 | """Test if list circuits return all circuits stored.""" |
|
381 | circuits = { |
|
382 | 'circuits': |
|
383 | {"1": {"name": "circuit_1"}, "2": {"name": "circuit_2"}} |
|
384 | } |
|
385 | get_circuits = self.napp.mongo_controller.get_circuits |
|
386 | get_circuits.return_value = circuits |
|
387 | ||
388 | url = f"{self.base_endpoint}/v2/evc/" |
|
389 | response = await self.api_client.get(url) |
|
390 | expected_result = circuits["circuits"] |
|
391 | get_circuits.assert_called_with(archived="false", metadata={}) |
|
392 | assert response.json() == expected_result |
|
393 | ||
394 | async def test_list_with_archived_circuits_archived(self): |
|
395 | """Test if list circuits only archived circuits.""" |