mirror of
https://github.com/status-im/status-go.git
synced 2026-08-31 17:11:23 +00:00
tests-functional/ -> test/functional/ tests-unit-network/ -> test/unit-network/ No Go code changes beyond the two package paths. Every reference follows: Makefile targets, the pytest-lint and reliability workflows, the three Jenkinsfiles, the root Dockerfile, pyrightconfig.json, .gitignore, the benchmark and functional-test scripts, and the docs. All paths inside the moved directories are self-contained (docker compose uses `context: .`, the Python helpers resolve from __file__), so the extra level of nesting does not reach outside. refs #7067
49 lines
2.3 KiB
Python
49 lines
2.3 KiB
Python
import pytest
|
|
|
|
|
|
@pytest.mark.rpc
|
|
class TestBackupSettings:
|
|
|
|
@pytest.fixture()
|
|
def config(self, backend_new_profile):
|
|
return backend_new_profile("settings-backend")
|
|
|
|
@pytest.mark.skip(reason="backend currently does not validate backup-path; it is stored verbatim")
|
|
def test_set_invalid_backup_path(self, config):
|
|
invalid_path = "/invalid/path/that/does@$<>not|exist"
|
|
result = config.settings_service.save_setting("backup-path", invalid_path)
|
|
backup_path = config.settings_service.backup_path()
|
|
assert backup_path != invalid_path, f"Backend incorrectly saved invalid path: {backup_path}"
|
|
assert result is None or result == "", f"Expected save_setting to fail or return None, got: {result}"
|
|
|
|
def test_set_valid_backup_path(self, config):
|
|
current_path = config.settings_service.backup_path()
|
|
|
|
# Verify it is a valid path (not empty and is a string)
|
|
assert current_path is not None, "Backup path should not be None"
|
|
assert isinstance(current_path, str), f"Expected string, got {type(current_path)}"
|
|
assert current_path != "", "Backup path should not be empty"
|
|
|
|
# Test setting the same path explicitly (round-trip test)
|
|
result = config.settings_service.save_setting("backup-path", current_path)
|
|
assert result is None
|
|
assert config.settings_service.backup_path() == current_path
|
|
|
|
def test_get_backup_path_type_and_value(self, config):
|
|
backup_path = config.settings_service.backup_path()
|
|
assert backup_path is not None, "Expected a non-null backup path"
|
|
assert isinstance(backup_path, str), f"Expected string, got {type(backup_path)}"
|
|
assert backup_path != "", "Expected backup path to be non-empty"
|
|
|
|
def test_messages_backup_enabled_type(self, config):
|
|
result = config.settings_service.messages_backup_enabled()
|
|
assert result is not None, "Expected a non-null result"
|
|
assert isinstance(result, bool), f"Expected bool, got {type(result)}"
|
|
|
|
def test_toggle_messages_backup_enabled(self, config):
|
|
value = True
|
|
config.settings_service.save_setting("messages-backup-enabled?", value)
|
|
result = config.settings_service.messages_backup_enabled()
|
|
assert isinstance(result, bool)
|
|
assert result is value
|