From 6a44552cf017b68287ddad255df64e378d367213 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 26 Nov 2023 15:24:57 +0100 Subject: [PATCH] =?UTF-8?q?tests:=20Don=E2=80=99t=20check=20exact=20build?= =?UTF-8?q?=20tag=20length?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of requiring that the length of the build tag is exactly 7, we only ensure that it is at least 4. The exact length of the build tag depends on the current version number and whether it is build directly from a tag. --- tests/conftest.py | 1 - tests/test_nethsm_system.py | 16 ++++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 187f6f6..6caff3b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,7 +45,6 @@ class Constants: FIRMWARE_VERSION = "N/A" SOFTWARE_VERSION = "0.9" HARDWARE_VERSION = "N/A" - BUILD_TAG_LEN = 7 # test_nethsm_users, test_nethsm_config UNLOCK_PASSPHRASE_CHANGED = "unlockiunlocki" diff --git a/tests/test_nethsm_system.py b/tests/test_nethsm_system.py index 1470c11..b359671 100644 --- a/tests/test_nethsm_system.py +++ b/tests/test_nethsm_system.py @@ -35,17 +35,13 @@ def test_provision_system_info(nethsm: NetHSM) -> None: """Get system information for a NetHSM instance. This command requires authentication as a user with the Administrator - role. - TODO: do not rely on string constants, as nethsm:testing version changes - """ + role.""" info = nethsm.get_system_info() - assert type(info.firmware_version) is str - assert type(info.software_version) is str - assert type(info.hardware_version) is str - assert type(info.build_tag) is str - assert len(info.build_tag) == C.BUILD_TAG_LEN - - # fixme: this changes between the NetHSM instances + assert len(info.firmware_version) > 0 + assert len(info.software_version) > 0 + assert len(info.hardware_version) > 0 + # build tag should be vx.y with an optional suffix, so at least length 4 + assert len(info.build_tag) >= 4 def test_passphrase_add_user_retrieve_backup(nethsm: NetHSM) -> None: