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