-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into f-list-batches
- Loading branch information
Showing
19 changed files
with
392 additions
and
17 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
""" | ||
Provide errors for command line interface. | ||
""" | ||
|
||
|
||
class NotSupportedOsToGetNodePrivateKeyError(Exception): | ||
""" | ||
Operating system is not supported to get the node's private key error. | ||
""" | ||
|
||
def __init__(self, message): | ||
self.message = message |
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
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
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Provide tests for implementation of the node private key file. | ||
""" | ||
import pytest | ||
|
||
from cli.config import NodePrivateKey | ||
from cli.errors import NotSupportedOsToGetNodePrivateKeyError | ||
from tests.constants import NODE_PRIVATE_KEY_FILE_PATH_IN_TESTING | ||
|
||
|
||
def test_node_private_key_get(create_node_private_key_file): | ||
""" | ||
Case: get the node's private key. | ||
Expect: private key has been read from the node's private key file. | ||
""" | ||
private_key = NodePrivateKey.get(file_path=NODE_PRIVATE_KEY_FILE_PATH_IN_TESTING) | ||
assert '8a069bfff838f73d1b072ba72ee0f61b19d9b7216d5a735d7ff4d15063dd9772' == private_key | ||
|
||
|
||
@pytest.mark.parametrize('operating_system', ['Darwin', 'Windows']) | ||
def test_node_private_key_get_not_supported_os(operating_system, mocker): | ||
""" | ||
Case: get the node's private key from not supported operating system. | ||
Expect: operating system is not supported to get the node's private key error message. | ||
""" | ||
mock_account_get_balance = mocker.patch('platform.system') | ||
mock_account_get_balance.return_value = operating_system | ||
|
||
with pytest.raises(NotSupportedOsToGetNodePrivateKeyError) as error: | ||
NodePrivateKey.get(file_path=NODE_PRIVATE_KEY_FILE_PATH_IN_TESTING) | ||
|
||
assert 'The current operating system is not supported to get the node\'s private key.' in error.value.message | ||
|
||
|
||
def test_node_private_key_get_from_non_existing_file(): | ||
""" | ||
Case: get the node's private key from non-existing file. | ||
Expect: private key hasn't been founded on the machine error message. | ||
""" | ||
with pytest.raises(FileNotFoundError) as error: | ||
NodePrivateKey.get(file_path=NODE_PRIVATE_KEY_FILE_PATH_IN_TESTING) | ||
|
||
assert 'Private key hasn\'t been founded on the machine.' in str(error) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
""" | ||
Provide constants for testing a command line interface. | ||
""" | ||
import pathlib | ||
|
||
NODE_PRIVATE_KEY_DIRECTORY_PATH = str(pathlib.Path.home()) + '/docker/volumes/remme_validator_keys/_data/' | ||
NODE_PRIVATE_KEY_FILE_PATH_IN_TESTING = NODE_PRIVATE_KEY_DIRECTORY_PATH + 'validator.priv' |
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 @@ | ||
8a069bfff838f73d1b072ba72ee0f61b19d9b7216d5a735d7ff4d15063dd9772 |
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
Oops, something went wrong.