|
@@ 395-412 (lines=18) @@
|
| 392 |
|
get_circuits.assert_called_with(archived=False) |
| 393 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 394 |
|
|
| 395 |
|
def test_list_with_archived_circuits_archived(self): |
| 396 |
|
"""Test if list circuits only archived circuits.""" |
| 397 |
|
circuits = { |
| 398 |
|
'circuits': |
| 399 |
|
{ |
| 400 |
|
"1": {"name": "circuit_1", "archived": True}, |
| 401 |
|
} |
| 402 |
|
} |
| 403 |
|
get_circuits = self.napp.mongo_controller.get_circuits |
| 404 |
|
get_circuits.return_value = circuits |
| 405 |
|
|
| 406 |
|
api = self.get_app_test_client(self.napp) |
| 407 |
|
url = f"{self.server_name_url}/v2/evc/?archived=true" |
| 408 |
|
|
| 409 |
|
response = api.get(url) |
| 410 |
|
get_circuits.assert_called_with(archived=True) |
| 411 |
|
expected_result = {"1": circuits["circuits"]["1"]} |
| 412 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 413 |
|
|
| 414 |
|
def test_list_with_archived_circuits_all(self): |
| 415 |
|
"""Test if list circuits return all circuits.""" |
|
@@ 378-393 (lines=16) @@
|
| 375 |
|
expected_result = circuits["circuits"] |
| 376 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 377 |
|
|
| 378 |
|
def test_list_with_circuits_stored(self): |
| 379 |
|
"""Test if list circuits return all circuits stored.""" |
| 380 |
|
circuits = { |
| 381 |
|
'circuits': |
| 382 |
|
{"1": {"name": "circuit_1"}, "2": {"name": "circuit_2"}} |
| 383 |
|
} |
| 384 |
|
get_circuits = self.napp.mongo_controller.get_circuits |
| 385 |
|
get_circuits.return_value = circuits |
| 386 |
|
|
| 387 |
|
api = self.get_app_test_client(self.napp) |
| 388 |
|
url = f"{self.server_name_url}/v2/evc/" |
| 389 |
|
|
| 390 |
|
response = api.get(url) |
| 391 |
|
expected_result = circuits["circuits"] |
| 392 |
|
get_circuits.assert_called_with(archived=False) |
| 393 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 394 |
|
|
| 395 |
|
def test_list_with_archived_circuits_archived(self): |
| 396 |
|
"""Test if list circuits only archived circuits.""" |