|
26 | 26 | )
|
27 | 27 |
|
28 | 28 |
|
29 |
| -def test_attach_initial(): |
| 29 | +def test_attach_initial(mock_get_external_ip): |
30 | 30 | # Create a mock AxonServer instance
|
31 | 31 | server = Axon()
|
32 | 32 |
|
@@ -71,7 +71,7 @@ def wrong_verify_fn(synapse: TestSynapse) -> bool:
|
71 | 71 | server.attach(forward_fn, blacklist_fn, priority_fn, wrong_verify_fn)
|
72 | 72 |
|
73 | 73 |
|
74 |
| -def test_attach(): |
| 74 | +def test_attach(mock_get_external_ip): |
75 | 75 | # Create a mock AxonServer instance
|
76 | 76 | server = Axon()
|
77 | 77 |
|
@@ -144,7 +144,7 @@ def mock_request():
|
144 | 144 |
|
145 | 145 |
|
146 | 146 | @pytest.fixture
|
147 |
| -def axon_instance(): |
| 147 | +def axon_instance(mock_get_external_ip): |
148 | 148 | axon = Axon()
|
149 | 149 | axon.required_hash_fields = {"test_endpoint": ["field1", "field2"]}
|
150 | 150 | axon.forward_class_types = {
|
@@ -329,7 +329,7 @@ async def test_verify_body_integrity_error_cases(
|
329 | 329 | (MockInfo(), "MockInfoString", "edge_case_empty_string"),
|
330 | 330 | ],
|
331 | 331 | )
|
332 |
| -def test_to_string(info_return, expected_output, test_id): |
| 332 | +def test_to_string(info_return, expected_output, test_id, mock_get_external_ip): |
333 | 333 | # Arrange
|
334 | 334 | axon = Axon()
|
335 | 335 | with patch.object(axon, "info", return_value=info_return):
|
@@ -358,7 +358,9 @@ def test_to_string(info_return, expected_output, test_id):
|
358 | 358 | ),
|
359 | 359 | ],
|
360 | 360 | )
|
361 |
| -def test_valid_ipv4_and_ipv6_address(ip, port, expected_ip_type, test_id): |
| 361 | +def test_valid_ipv4_and_ipv6_address( |
| 362 | + ip, port, expected_ip_type, test_id, mock_get_external_ip |
| 363 | +): |
362 | 364 | # Arrange
|
363 | 365 | hotkey = MockHotkey("5EemgxS7cmYbD34esCFoBgUZZC8JdnGtQvV5Qw3QFUCRRtGP")
|
364 | 366 | coldkey = MockHotkey("5EemgxS7cmYbD34esCFoBgUZZC8JdnGtQvV5Qw3QFUCRRtGP")
|
@@ -431,7 +433,14 @@ def test_invalid_ip_address(ip, port, expected_exception):
|
431 | 433 | ],
|
432 | 434 | )
|
433 | 435 | def test_axon_str_representation(
|
434 |
| - ip, port, ss58_address, started, forward_fns, expected_str, test_id |
| 436 | + ip, |
| 437 | + port, |
| 438 | + ss58_address, |
| 439 | + started, |
| 440 | + forward_fns, |
| 441 | + expected_str, |
| 442 | + test_id, |
| 443 | + mock_get_external_ip, |
435 | 444 | ):
|
436 | 445 | # Arrange
|
437 | 446 | hotkey = MockHotkey(ss58_address)
|
|
0 commit comments