Skip to content

Commit

Permalink
Move mock of getting ursula version to the porter fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
vzotova committed Aug 6, 2024
1 parent ee9ee47 commit ef31aee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def mock_signer(get_random_checksum_address):

@pytest.fixture(scope="module")
@pytest.mark.usefixtures('testerchain', 'agency')
def porter(ursulas, mock_rest_middleware, test_registry):
def porter(ursulas, mock_rest_middleware, test_registry, module_mocker):
porter = Porter(
domain=TEMPORARY_DOMAIN,
eth_endpoint=MOCK_ETH_PROVIDER_URI,
Expand All @@ -259,6 +259,7 @@ def porter(ursulas, mock_rest_middleware, test_registry):
verify_node_bonding=False,
network_middleware=mock_rest_middleware,
)
module_mocker.patch.object(porter, "_get_ursula_version", return_value="7.4.0")
yield porter
porter.stop_learning_loop()

Expand Down
7 changes: 0 additions & 7 deletions tests/test_get_ursulas.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,15 +195,12 @@ def test_get_ursulas_schema(get_random_checksum_address):
@pytest.mark.parametrize("timeout", [None, 15, 20])
@pytest.mark.parametrize("duration", [None, 0, 60 * 60 * 24, 60 * 60 * 24 * 365])
def test_get_ursulas_python_interface(
mocker,
porter,
ursulas,
timeout,
duration,
excluded_staker_address_for_duration_greater_than_0,
):
mocker.patch.object(porter, "_get_ursula_version", return_value="7.4.0")

# simple
quantity = 4
ursulas_info = porter.get_ursulas(quantity=quantity)
Expand Down Expand Up @@ -289,16 +286,12 @@ def test_get_ursulas_python_interface(
@pytest.mark.parametrize("timeout", [None, 10, 20])
@pytest.mark.parametrize("duration", [None, 0, 60 * 60 * 24, 60 * 60 * 24 * 365])
def test_get_ursulas_web_interface(
mocker,
porter,
porter_web_controller,
ursulas,
timeout,
duration,
excluded_staker_address_for_duration_greater_than_0,
):
mocker.patch.object(porter, "_get_ursula_version", return_value="7.4.0")

# Send bad data to assert error return
response = porter_web_controller.get(
"/get_ursulas", data=json.dumps({"bad": "input"})
Expand Down

0 comments on commit ef31aee

Please sign in to comment.