Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

network: Update regexp #639

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pytest_tests/testsuites/network/test_config_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,23 @@ def test_config_update_multiple_values(self, clean_config: None):
self._set_and_verify_config_keys(**new_key_value_pairs)

@pytest.mark.parametrize(
"key, value",
"key, value, expected_type",
[
("MaxObjectSize", "VeryBigSize"),
("BasicIncomeRate", False),
("HomomorphicHashingDisabled", 0.2),
("MaxObjectSize", "VeryBigSize", int),
("BasicIncomeRate", False, int),
("HomomorphicHashingDisabled", 0.2, bool),
],
)
@allure.title("Set network config key to invalid value")
def test_config_set_invalid_value(self, key: str, value: Union[str, int, bool]):
with pytest.raises(RuntimeError, match=f".*could not parse.*"):
def test_config_set_invalid_value(self, key: str, value: Union[str, int, bool], expected_type: type):
with pytest.raises(RuntimeError, match=f"Error: invalid value for {key} key, "
f"expected {expected_type.__name__}, got '{str(value).lower()}'"):
self._set_and_verify_config_keys(**{key: value})

@allure.title("Set multiple network config keys to invalid values with force")
def test_config_set_multiple_invalid_values(self):
with pytest.raises(RuntimeError, match=f".*could not parse.*"):
with pytest.raises(RuntimeError, match="Error: invalid value for MaxObjectSize key, "
"expected int, got 'verybigsize'"):
self._set_and_verify_config_keys(
**{"MaxObjectSize": "VeryBigSize", "BasicIncomeRate": False}, force=True
)
Expand Down
Loading