Skip to content

Commit bc8313d

Browse files
committed
Fix linter
1 parent 40fc1c4 commit bc8313d

3 files changed

Lines changed: 68 additions & 27 deletions

File tree

tests/cli/node_test.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,32 @@
1717
# You should have received a copy of the GNU Affero General Public License
1818
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1919

20+
import logging
2021
import pathlib
21-
import mock
2222
from unittest.mock import MagicMock, patch
2323

24-
import requests
25-
import logging
24+
import mock
2625
import pytest
26+
import requests
2727

28-
from node_cli.utils.node_type import NodeType
29-
30-
from node_cli.configs import INIT_ENV_FILEPATH, SKALE_DIR, G_CONF_HOME
3128
from node_cli.cli.node import (
29+
_set_domain_name,
30+
_turn_off,
31+
_turn_on,
32+
backup_node,
3233
node_info,
3334
register_node,
34-
signature,
35-
backup_node,
35+
remove_node_from_maintenance,
3636
restore_node,
3737
set_node_in_maintenance,
38-
remove_node_from_maintenance,
38+
signature,
3939
version,
40-
_turn_off,
41-
_turn_on,
42-
_set_domain_name,
4340
)
41+
from node_cli.configs import G_CONF_HOME, SKALE_DIR
4442
from node_cli.utils.exit_codes import CLIExitCodes
4543
from node_cli.utils.helper import init_default_logger
4644
from node_cli.utils.meta import CliMeta
47-
45+
from node_cli.utils.node_type import NodeType
4846
from tests.helper import (
4947
response_mock,
5048
run_command,

tests/configs/configs_env_validate_test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import os
22
from typing import Optional
33

4-
import mock
54
import pytest
65
import requests
76

87
from node_cli.configs.alias_address_validation import (
98
ContractType,
109
get_chain_id,
1110
get_network_metadata,
11+
validate_alias_or_address,
1212
validate_contract_address,
1313
validate_contract_alias,
14-
validate_alias_or_address,
1514
)
1615
from node_cli.configs.user import (
1716
ALLOWED_ENV_TYPES,

tests/core/core_node_test.py

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@
1111

1212
from node_cli.configs import NODE_DATA_PATH, SCHAINS_MNT_DIR_REGULAR, SCHAINS_MNT_DIR_SINGLE_CHAIN
1313
from node_cli.configs.resource_allocation import RESOURCE_ALLOCATION_FILEPATH
14-
from node_cli.configs.user import SkaleUserConfig
1514
from node_cli.core.node import (
15+
compose_node_env,
1616
get_expected_container_names,
17-
is_base_containers_alive,
1817
init,
18+
is_base_containers_alive,
19+
is_update_safe,
1920
pack_dir,
2021
update,
21-
is_update_safe,
22-
compose_node_env,
2322
)
2423
from node_cli.utils.meta import CliMeta
2524
from node_cli.utils.node_type import NodeType
26-
2725
from tests.helper import response_mock, safe_update_api_response, subprocess_run_mock
2826
from tests.resources_test import BIG_DISK_SIZE
2927

@@ -154,11 +152,56 @@ def test_is_base_containers_alive_empty(node_type, is_boot):
154152
'expect_flask_key, expect_backup_run'
155153
),
156154
[
157-
(NodeType.REGULAR, 'regular_user_conf', False, True, False, SCHAINS_MNT_DIR_REGULAR, True, False),
158-
(NodeType.REGULAR, 'regular_user_conf', False, True, True, SCHAINS_MNT_DIR_REGULAR, True, True),
159-
(NodeType.SYNC, 'sync_user_conf', False, False, False, SCHAINS_MNT_DIR_SINGLE_CHAIN, False, False),
160-
(NodeType.MIRAGE, 'mirage_boot_user_conf', True, True, False, SCHAINS_MNT_DIR_SINGLE_CHAIN, True, False),
161-
(NodeType.MIRAGE, 'mirage_user_conf', False, True, False, SCHAINS_MNT_DIR_SINGLE_CHAIN, True, False),
155+
(
156+
NodeType.REGULAR,
157+
'regular_user_conf',
158+
False,
159+
True,
160+
False,
161+
SCHAINS_MNT_DIR_REGULAR,
162+
True,
163+
False,
164+
),
165+
(
166+
NodeType.REGULAR,
167+
'regular_user_conf',
168+
False,
169+
True,
170+
True,
171+
SCHAINS_MNT_DIR_REGULAR,
172+
True,
173+
True,
174+
),
175+
(
176+
NodeType.SYNC,
177+
'sync_user_conf',
178+
False,
179+
False,
180+
False,
181+
SCHAINS_MNT_DIR_SINGLE_CHAIN,
182+
False,
183+
False,
184+
),
185+
(
186+
NodeType.MIRAGE,
187+
'mirage_boot_user_conf',
188+
True,
189+
True,
190+
False,
191+
SCHAINS_MNT_DIR_SINGLE_CHAIN,
192+
True,
193+
False,
194+
),
195+
(
196+
NodeType.MIRAGE,
197+
'mirage_user_conf',
198+
False,
199+
True,
200+
False,
201+
SCHAINS_MNT_DIR_SINGLE_CHAIN,
202+
True,
203+
False,
204+
),
162205
],
163206
ids=[
164207
'regular',
@@ -188,7 +231,7 @@ def test_compose_node_env(
188231
with (
189232
mock.patch('node_cli.configs.user.validate_alias_or_address'),
190233
mock.patch('node_cli.core.node.save_env_params'),
191-
mock.patch('node_cli.core.node.get_flask_secret_key', return_value='mock_secret')
234+
mock.patch('node_cli.core.node.get_flask_secret_key', return_value='mock_secret'),
192235
):
193236
result_env = compose_node_env(
194237
env_filepath=user_config_path.as_posix(),
@@ -274,6 +317,7 @@ def resource_file():
274317
if os.path.exists(RESOURCE_ALLOCATION_FILEPATH):
275318
os.remove(RESOURCE_ALLOCATION_FILEPATH)
276319

320+
277321
def test_init_node(regular_user_conf, no_resource_file): # todo: write new init node test
278322
resp_mock = response_mock(requests.codes.created)
279323
assert not os.path.isfile(RESOURCE_ALLOCATION_FILEPATH)
@@ -318,7 +362,7 @@ def test_update_node(regular_user_conf, mocked_g_config, resource_file, inited_n
318362
result = update(
319363
regular_user_conf.as_posix(),
320364
pull_config_for_schain=None,
321-
node_type=NodeType.REGULAR
365+
node_type=NodeType.REGULAR,
322366
)
323367
assert result is None
324368

0 commit comments

Comments
 (0)