|
@@ 428-446 (lines=19) @@
|
| 425 |
|
get_circuits.assert_called_with(archived="false", metadata={}) |
| 426 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 427 |
|
|
| 428 |
|
def test_list_with_archived_circuits_archived(self): |
| 429 |
|
"""Test if list circuits only archived circuits.""" |
| 430 |
|
circuits = { |
| 431 |
|
'circuits': |
| 432 |
|
{ |
| 433 |
|
"1": {"name": "circuit_1", "archived": True}, |
| 434 |
|
} |
| 435 |
|
} |
| 436 |
|
get_circuits = self.napp.mongo_controller.get_circuits |
| 437 |
|
get_circuits.return_value = circuits |
| 438 |
|
|
| 439 |
|
api = self.get_app_test_client(self.napp) |
| 440 |
|
url = f"{self.server_name_url}/v2/evc/?archived=true&metadata.a=1" |
| 441 |
|
|
| 442 |
|
response = api.get(url) |
| 443 |
|
get_circuits.assert_called_with(archived="true", |
| 444 |
|
metadata={"metadata.a": "1"}) |
| 445 |
|
expected_result = {"1": circuits["circuits"]["1"]} |
| 446 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 447 |
|
|
| 448 |
|
def test_list_with_archived_circuits_all(self): |
| 449 |
|
"""Test if list circuits return all circuits.""" |
|
@@ 411-426 (lines=16) @@
|
| 408 |
|
expected_result = circuits["circuits"] |
| 409 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 410 |
|
|
| 411 |
|
def test_list_with_circuits_stored(self): |
| 412 |
|
"""Test if list circuits return all circuits stored.""" |
| 413 |
|
circuits = { |
| 414 |
|
'circuits': |
| 415 |
|
{"1": {"name": "circuit_1"}, "2": {"name": "circuit_2"}} |
| 416 |
|
} |
| 417 |
|
get_circuits = self.napp.mongo_controller.get_circuits |
| 418 |
|
get_circuits.return_value = circuits |
| 419 |
|
|
| 420 |
|
api = self.get_app_test_client(self.napp) |
| 421 |
|
url = f"{self.server_name_url}/v2/evc/" |
| 422 |
|
|
| 423 |
|
response = api.get(url) |
| 424 |
|
expected_result = circuits["circuits"] |
| 425 |
|
get_circuits.assert_called_with(archived="false", metadata={}) |
| 426 |
|
self.assertEqual(json.loads(response.data), expected_result) |
| 427 |
|
|
| 428 |
|
def test_list_with_archived_circuits_archived(self): |
| 429 |
|
"""Test if list circuits only archived circuits.""" |