more tests for command invocations

This commit is contained in:
Brian S. Stephan 2023-06-21 17:54:27 -05:00
parent 5b8dc456f1
commit 88ca5c5152
Signed by: bss
GPG Key ID: 3DE06D3180895FCB
2 changed files with 17 additions and 0 deletions

View File

@ -72,6 +72,7 @@ def get_config_from_file(filename: str, whole_board: bool = False) -> dict:
Args:
filename: the filename of the file to open and read
whole_board: optional, if true, attempt to find the storage section from its normal location on a board
Returns:
the parsed configuration
"""

View File

@ -15,3 +15,19 @@ def test_help_flag():
result = run(['visualize-storage', '-h'], capture_output=True, encoding='utf8')
assert 'usage: visualize-storage' in result.stdout
assert 'Read the configuration section from a dump of a GP2040-CE board' in result.stdout
def test_storage_dump_invocation():
"""Test that a normal invocation against a dump works."""
result = run(['visualize-storage', '-P', 'tests/test-files/proto-files', 'tests/test-files/test-storage-area.bin'],
capture_output=True, encoding='utf8')
assert 'boardVersion: "v0.7.2"' in result.stdout
def test_debug_storage_dump_invocation():
"""Test that a normal invocation against a dump works."""
result = run(['visualize-storage', '-d', '-P', 'tests/test-files/proto-files',
'tests/test-files/test-storage-area.bin'],
capture_output=True, encoding='utf8')
assert 'boardVersion: "v0.7.2"' in result.stdout
assert 'length of content to look for footer in: 8192' in result.stderr