|
31 | 31 | )
|
32 | 32 |
|
33 | 33 |
|
34 |
| -def test_attach_initial(): |
| 34 | +def test_attach_initial(mock_get_external_ip): |
35 | 35 | # Create a mock AxonServer instance
|
36 | 36 | server = Axon()
|
37 | 37 |
|
@@ -76,7 +76,7 @@ def wrong_verify_fn(synapse: TestSynapse) -> bool:
|
76 | 76 | server.attach(forward_fn, blacklist_fn, priority_fn, wrong_verify_fn)
|
77 | 77 |
|
78 | 78 |
|
79 |
| -def test_attach(): |
| 79 | +def test_attach(mock_get_external_ip): |
80 | 80 | # Create a mock AxonServer instance
|
81 | 81 | server = Axon()
|
82 | 82 |
|
@@ -149,7 +149,7 @@ def mock_request():
|
149 | 149 |
|
150 | 150 |
|
151 | 151 | @pytest.fixture
|
152 |
| -def axon_instance(): |
| 152 | +def axon_instance(mock_get_external_ip): |
153 | 153 | axon = Axon()
|
154 | 154 | axon.required_hash_fields = {"test_endpoint": ["field1", "field2"]}
|
155 | 155 | axon.forward_class_types = {
|
@@ -334,7 +334,7 @@ async def test_verify_body_integrity_error_cases(
|
334 | 334 | (MockInfo(), "MockInfoString", "edge_case_empty_string"),
|
335 | 335 | ],
|
336 | 336 | )
|
337 |
| -def test_to_string(info_return, expected_output, test_id): |
| 337 | +def test_to_string(info_return, expected_output, test_id, mock_get_external_ip): |
338 | 338 | # Arrange
|
339 | 339 | axon = Axon()
|
340 | 340 | with patch.object(axon, "info", return_value=info_return):
|
@@ -363,7 +363,9 @@ def test_to_string(info_return, expected_output, test_id):
|
363 | 363 | ),
|
364 | 364 | ],
|
365 | 365 | )
|
366 |
| -def test_valid_ipv4_and_ipv6_address(ip, port, expected_ip_type, test_id): |
| 366 | +def test_valid_ipv4_and_ipv6_address( |
| 367 | + ip, port, expected_ip_type, test_id, mock_get_external_ip |
| 368 | +): |
367 | 369 | # Arrange
|
368 | 370 | hotkey = MockHotkey("5EemgxS7cmYbD34esCFoBgUZZC8JdnGtQvV5Qw3QFUCRRtGP")
|
369 | 371 | coldkey = MockHotkey("5EemgxS7cmYbD34esCFoBgUZZC8JdnGtQvV5Qw3QFUCRRtGP")
|
@@ -436,7 +438,14 @@ def test_invalid_ip_address(ip, port, expected_exception):
|
436 | 438 | ],
|
437 | 439 | )
|
438 | 440 | def test_axon_str_representation(
|
439 |
| - ip, port, ss58_address, started, forward_fns, expected_str, test_id |
| 441 | + ip, |
| 442 | + port, |
| 443 | + ss58_address, |
| 444 | + started, |
| 445 | + forward_fns, |
| 446 | + expected_str, |
| 447 | + test_id, |
| 448 | + mock_get_external_ip, |
440 | 449 | ):
|
441 | 450 | # Arrange
|
442 | 451 | hotkey = MockHotkey(ss58_address)
|
|
0 commit comments