Skip to content

Commit

Permalink
Update hv query tests
Browse files Browse the repository at this point in the history
Update tests to change server property from HYPERVISOR_ID to HYPERVISOR_NAME
  • Loading branch information
gmatthews20 committed Sep 26, 2024
1 parent 8361f67 commit 3cb10c3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/enums/query/props/server_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 4 additions & 3 deletions tests/enums/props/test_server_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion tests/lib/openstack_query/mappings/test_server_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3cb10c3

Please sign in to comment.