|
@@ 57-79 (lines=23) @@
|
| 54 |
|
for delay in delays: |
| 55 |
|
self.assertEqual(delay > requirements["delay"], False) |
| 56 |
|
|
| 57 |
|
def test_path3(self): |
| 58 |
|
"""Tests to see if the edges used in the paths from User 1 to User 2 |
| 59 |
|
have at least 20 bandwidth.""" |
| 60 |
|
|
| 61 |
|
self.test_setup() |
| 62 |
|
bandwidths = [] |
| 63 |
|
requirements = {"bandwidth": 20} |
| 64 |
|
|
| 65 |
|
result = self.get_path_constrained( |
| 66 |
|
"User1", "User2", base=requirements) |
| 67 |
|
|
| 68 |
|
if result: |
| 69 |
|
for path in result[0]["paths"]: |
| 70 |
|
for i in range(1, len(path)): |
| 71 |
|
endpoint_a = path[i - 1] |
| 72 |
|
endpoint_b = path[i] |
| 73 |
|
meta_data = self.graph.get_metadata_from_link( |
| 74 |
|
endpoint_a, endpoint_b) |
| 75 |
|
if meta_data and "bandwidth" in meta_data.keys(): |
| 76 |
|
bandwidths.append(meta_data["bandwidth"]) |
| 77 |
|
|
| 78 |
|
for bandwidth in bandwidths: |
| 79 |
|
self.assertEqual(bandwidth < requirements["bandwidth"], False) |
| 80 |
|
|
| 81 |
|
def test_path3(self): |
| 82 |
|
"""Tests to see if the edges used in the paths from User 1 to User 2 |
|
@@ 33-55 (lines=23) @@
|
| 30 |
|
|
| 31 |
|
self.assertNotIn(poor_reliability, reliabilities) |
| 32 |
|
|
| 33 |
|
def test_path2(self): |
| 34 |
|
"""Tests to see if the edges used in the paths from User 1 to User 2 |
| 35 |
|
have less than 30 delay.""" |
| 36 |
|
|
| 37 |
|
self.test_setup() |
| 38 |
|
delays = [] |
| 39 |
|
requirements = {"delay": 29} |
| 40 |
|
|
| 41 |
|
result = self.get_path_constrained( |
| 42 |
|
"User1", "User2", base=requirements) |
| 43 |
|
|
| 44 |
|
if result: |
| 45 |
|
for path in result[0]["paths"]: |
| 46 |
|
for i in range(1, len(path)): |
| 47 |
|
endpoint_a = path[i - 1] |
| 48 |
|
endpoint_b = path[i] |
| 49 |
|
meta_data = self.graph.get_metadata_from_link( |
| 50 |
|
endpoint_a, endpoint_b) |
| 51 |
|
if meta_data and "delay" in meta_data.keys(): |
| 52 |
|
delays.append(meta_data["delay"]) |
| 53 |
|
|
| 54 |
|
for delay in delays: |
| 55 |
|
self.assertEqual(delay > requirements["delay"], False) |
| 56 |
|
|
| 57 |
|
def test_path3(self): |
| 58 |
|
"""Tests to see if the edges used in the paths from User 1 to User 2 |