Skip to content

Commit

Permalink
[tools/shoestring]: fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Wayonb committed Nov 27, 2024
1 parent 4b43339 commit 15abaad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
1 change: 0 additions & 1 deletion tools/shoestring/shoestring/internal/NodeKeyProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@ def create_key_file(self, factory):
raise RuntimeError('unable to generate node private key')

factory.generate_random_node_private_key()

10 changes: 8 additions & 2 deletions tools/shoestring/tests/commands/test_import_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,21 @@ async def _run_test(is_harvester, is_voter, is_node_key, expected_imports_harves
# region success

async def test_can_import_with_neither_harvester_nor_voter_nor_node_key():
await _run_test(False, False, False,'', '', '')
await _run_test(False, False, False, '', '', '')


async def test_can_import_with_harvester_but_not_voter_or_node_key():
await _run_test(True, False, False,'{bootstrap_root}/nodes/node/server-config/resources/config-harvesting.properties', '', '')
await _run_test(True, False, False, '{bootstrap_root}/nodes/node/server-config/resources/config-harvesting.properties', '', '')


async def test_can_import_with_voter_but_not_harvester_or_node_key():
await _run_test(False, True, False, '', '{bootstrap_root}/nodes/node/votingkeys', '')


async def test_can_import_with_node_key_but_not_harvester_or_voter():
await _run_test(False, False, True, '', '', '{bootstrap_root}/nodes/node/cert/node.key.pem')


async def test_can_import_with_harvester_and_voter_but_not_node_key():
await _run_test(
True,
Expand All @@ -82,6 +84,7 @@ async def test_can_import_with_harvester_and_voter_but_not_node_key():
'{bootstrap_root}/nodes/node/votingkeys',
'')


async def test_can_import_with_harvester_and_node_key_but_not_voter():
await _run_test(
True,
Expand All @@ -91,6 +94,7 @@ async def test_can_import_with_harvester_and_node_key_but_not_voter():
'',
'{bootstrap_root}/nodes/node/cert/node.key.pem')


async def test_can_import_with_both_harvester_and_voter_and_node_key():
await _run_test(
True,
Expand Down Expand Up @@ -121,6 +125,7 @@ async def test_cannot_import_when_bootstrap_directory_invalid():

assert 1 == ex_info.value.code


async def test_cannot_import_when_node_key_does_not_exist():
# Arrange:
with tempfile.TemporaryDirectory() as output_directory:
Expand All @@ -141,4 +146,5 @@ async def test_cannot_import_when_node_key_does_not_exist():

# Assert:
assert 1 == ex_info.value.code

# endregion
1 change: 1 addition & 0 deletions tools/shoestring/tests/commands/test_renew_certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async def test_can_renew_node_certificate():
async def test_can_renew_node_certificate_with_ca_password():
await _assert_can_renew_node_certificate('abcd')


async def test_can_renew_node_certificate_with_retain_key():
await _assert_can_renew_node_certificate(retain_key=True)

Expand Down
3 changes: 1 addition & 2 deletions tools/shoestring/tests/internal/test_NodeKeyProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import unittest
from pathlib import Path

from shoestring.internal.NodeKeyProvider import NodeKeyProvider
from shoestring.internal.CertificateFactory import CertificateFactory
from shoestring.internal.NodeKeyProvider import NodeKeyProvider
from shoestring.internal.OpensslExecutor import OpensslExecutor


Expand Down Expand Up @@ -66,7 +66,6 @@ def _load_binary_file_data(filename):
renew_node_key_data = _load_binary_file_data(renew_node_key_filepath)
assert node_key_data == renew_node_key_data


def test_cannot_generates_node_key(self):
with self.assertRaises(RuntimeError):
node_key_provider = NodeKeyProvider(None)
Expand Down

0 comments on commit 15abaad

Please sign in to comment.