@@ 320-336 (lines=17) @@ | ||
317 | get_circuits.assert_called_with(archived="false", metadata={}) |
|
318 | assert response.json() == expected_result |
|
319 | ||
320 | async def test_list_with_archived_circuits_archived(self): |
|
321 | """Test if list circuits only archived circuits.""" |
|
322 | circuits = { |
|
323 | 'circuits': |
|
324 | { |
|
325 | "1": {"name": "circuit_1", "archived": True}, |
|
326 | } |
|
327 | } |
|
328 | get_circuits = self.napp.mongo_controller.get_circuits |
|
329 | get_circuits.return_value = circuits |
|
330 | ||
331 | url = f"{self.base_endpoint}/v2/evc/?archived=true&metadata.a=1" |
|
332 | response = await self.api_client.get(url) |
|
333 | get_circuits.assert_called_with(archived="true", |
|
334 | metadata={"metadata.a": "1"}) |
|
335 | expected_result = {"1": circuits["circuits"]["1"]} |
|
336 | assert response.json() == expected_result |
|
337 | ||
338 | async def test_list_with_archived_circuits_all(self): |
|
339 | """Test if list circuits return all circuits.""" |
|
@@ 305-318 (lines=14) @@ | ||
302 | expected_result = circuits["circuits"] |
|
303 | assert response.json() == expected_result |
|
304 | ||
305 | async def test_list_with_circuits_stored(self): |
|
306 | """Test if list circuits return all circuits stored.""" |
|
307 | circuits = { |
|
308 | 'circuits': |
|
309 | {"1": {"name": "circuit_1"}, "2": {"name": "circuit_2"}} |
|
310 | } |
|
311 | get_circuits = self.napp.mongo_controller.get_circuits |
|
312 | get_circuits.return_value = circuits |
|
313 | ||
314 | url = f"{self.base_endpoint}/v2/evc/" |
|
315 | response = await self.api_client.get(url) |
|
316 | expected_result = circuits["circuits"] |
|
317 | get_circuits.assert_called_with(archived="false", metadata={}) |
|
318 | assert response.json() == expected_result |
|
319 | ||
320 | async def test_list_with_archived_circuits_archived(self): |
|
321 | """Test if list circuits only archived circuits.""" |