From 3cb10c399cd404eafaf4d2562a0fc492079f9aec Mon Sep 17 00:00:00 2001 From: George Matthews Date: Thu, 26 Sep 2024 11:57:29 +0100 Subject: [PATCH] Update hv query tests Update tests to change server property from HYPERVISOR_ID to HYPERVISOR_NAME --- lib/enums/query/props/server_properties.py | 2 +- tests/enums/props/test_server_properties.py | 7 ++++--- .../openstack_query/mappings/test_hypervisor_mapping.py | 2 +- tests/lib/openstack_query/mappings/test_server_mapping.py | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/enums/query/props/server_properties.py b/lib/enums/query/props/server_properties.py index 432e107eb..119ce6a64 100644 --- a/lib/enums/query/props/server_properties.py +++ b/lib/enums/query/props/server_properties.py @@ -27,7 +27,7 @@ def _get_aliases(): A method that returns all valid string alias mappings """ return { - ServerProperties.HYPERVISOR_NAME: ["hv_name"], + ServerProperties.HYPERVISOR_NAME: ["hv_name", "hypervisor_name"], ServerProperties.SERVER_CREATION_DATE: ["created_at"], ServerProperties.SERVER_DESCRIPTION: [ "description", diff --git a/tests/enums/props/test_server_properties.py b/tests/enums/props/test_server_properties.py index 878433c73..aab1d092b 100644 --- a/tests/enums/props/test_server_properties.py +++ b/tests/enums/props/test_server_properties.py @@ -43,13 +43,14 @@ def test_flavor_id_serialization(val): @pytest.mark.parametrize( - "val", ["hypervisor_id", "Hypervisor_ID", "HyPerVisor_ID", "host_id", "hv_id"] + "val", + ["hypervisor_name", "Hypervisor_NAME", "HyPerVisor_NamE", "hv_name", "hV_nAmE"], ) -def test_hypervisor_id_serialization(val): +def test_hypervisor_name_serialization(val): """ Tests that variants of HYPERVISOR_ID can be serialized """ - assert ServerProperties.from_string(val) is ServerProperties.HYPERVISOR_ID + assert ServerProperties.from_string(val) is ServerProperties.HYPERVISOR_NAME @pytest.mark.parametrize("val", ["image_id", "Image_ID", "ImaGe_iD"]) diff --git a/tests/lib/openstack_query/mappings/test_hypervisor_mapping.py b/tests/lib/openstack_query/mappings/test_hypervisor_mapping.py index 4dcc64323..35f47cb10 100644 --- a/tests/lib/openstack_query/mappings/test_hypervisor_mapping.py +++ b/tests/lib/openstack_query/mappings/test_hypervisor_mapping.py @@ -103,7 +103,7 @@ def test_get_chain_mappings(): Tests get_chain_mapping outputs correctly """ expected_mappings = { - HypervisorProperties.HYPERVISOR_ID: ServerProperties.HYPERVISOR_ID, + HypervisorProperties.HYPERVISOR_NAME: ServerProperties.HYPERVISOR_NAME, } assert HypervisorMapping.get_chain_mappings() == expected_mappings diff --git a/tests/lib/openstack_query/mappings/test_server_mapping.py b/tests/lib/openstack_query/mappings/test_server_mapping.py index 88997fcaf..7593b7293 100644 --- a/tests/lib/openstack_query/mappings/test_server_mapping.py +++ b/tests/lib/openstack_query/mappings/test_server_mapping.py @@ -210,7 +210,7 @@ def test_get_chain_mappings(): ServerProperties.PROJECT_ID: ProjectProperties.PROJECT_ID, ServerProperties.FLAVOR_ID: FlavorProperties.FLAVOR_ID, ServerProperties.IMAGE_ID: ImageProperties.IMAGE_ID, - ServerProperties.HYPERVISOR_ID: HypervisorProperties.HYPERVISOR_ID, + ServerProperties.HYPERVISOR_NAME: HypervisorProperties.HYPERVISOR_NAME, } assert ServerMapping.get_chain_mappings() == expected_mappings