Skip to content

Commit

Permalink
network: Update regexp
Browse files Browse the repository at this point in the history
Updated regular expressions in tests for setting an invalid value in the
network configuration key.

Closes #637

Signed-off-by: Oleg Kulachenko <oleg@nspcc.ru>
  • Loading branch information
vvarg229 committed Sep 14, 2023
1 parent 7af282f commit 2d98fde
Showing 1 changed file with 9 additions and 7 deletions.
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

0 comments on commit 2d98fde

Please sign in to comment.