@@ 379-396 (lines=18) @@ | ||
376 | get_circuits.assert_called_with(archived=False) |
|
377 | self.assertEqual(json.loads(response.data), expected_result) |
|
378 | ||
379 | def test_list_with_archived_circuits_archived(self): |
|
380 | """Test if list circuits only archived circuits.""" |
|
381 | circuits = { |
|
382 | 'circuits': |
|
383 | { |
|
384 | "1": {"name": "circuit_1", "archived": True}, |
|
385 | } |
|
386 | } |
|
387 | get_circuits = self.napp.mongo_controller.get_circuits |
|
388 | get_circuits.return_value = circuits |
|
389 | ||
390 | api = self.get_app_test_client(self.napp) |
|
391 | url = f"{self.server_name_url}/v2/evc/?archived=true" |
|
392 | ||
393 | response = api.get(url) |
|
394 | get_circuits.assert_called_with(archived=True) |
|
395 | expected_result = {"1": circuits["circuits"]["1"]} |
|
396 | self.assertEqual(json.loads(response.data), expected_result) |
|
397 | ||
398 | def test_list_with_archived_circuits_all(self): |
|
399 | """Test if list circuits return all circuits.""" |
|
@@ 362-377 (lines=16) @@ | ||
359 | expected_result = circuits["circuits"] |
|
360 | self.assertEqual(json.loads(response.data), expected_result) |
|
361 | ||
362 | def test_list_with_circuits_stored(self): |
|
363 | """Test if list circuits return all circuits stored.""" |
|
364 | circuits = { |
|
365 | 'circuits': |
|
366 | {"1": {"name": "circuit_1"}, "2": {"name": "circuit_2"}} |
|
367 | } |
|
368 | get_circuits = self.napp.mongo_controller.get_circuits |
|
369 | get_circuits.return_value = circuits |
|
370 | ||
371 | api = self.get_app_test_client(self.napp) |
|
372 | url = f"{self.server_name_url}/v2/evc/" |
|
373 | ||
374 | response = api.get(url) |
|
375 | expected_result = circuits["circuits"] |
|
376 | get_circuits.assert_called_with(archived=False) |
|
377 | self.assertEqual(json.loads(response.data), expected_result) |
|
378 | ||
379 | def test_list_with_archived_circuits_archived(self): |
|
380 | """Test if list circuits only archived circuits.""" |