-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Toggle repair through node_cli schain status file
- Loading branch information
Showing
7 changed files
with
83 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
import datetime | ||
|
||
import freezegun | ||
|
||
from node_cli.core.schains import toggle_schain_repair_mode | ||
from node_cli.utils.helper import read_json | ||
|
||
|
||
CURRENT_TIMESTAMP = 1594903080 | ||
CURRENT_DATETIME = datetime.datetime.utcfromtimestamp(CURRENT_TIMESTAMP) | ||
|
||
|
||
@freezegun.freeze_time(CURRENT_DATETIME) | ||
def test_toggle_repair_mode(tmp_schains_dir): | ||
schain_name = "test_schain" | ||
schain_folder = os.path.join(tmp_schains_dir, schain_name) | ||
os.mkdir(schain_folder) | ||
toggle_schain_repair_mode(schain_name) | ||
schain_status_path = os.path.join(schain_folder, "node-cli.status") | ||
assert os.path.isfile(schain_status_path) | ||
|
||
assert read_json(schain_status_path) == { | ||
'repair_ts': CURRENT_TIMESTAMP, | ||
'schain_name': 'test_schain', | ||
} | ||
|
||
toggle_schain_repair_mode(schain_name, snapshot_from='127.0.0.1') | ||
|
||
assert read_json(schain_status_path) == { | ||
'repair_ts': CURRENT_TIMESTAMP, | ||
'schain_name': 'test_schain', | ||
'snapshot_from': '127.0.0.1', | ||
} |
This file was deleted.
Oops, something went wrong.