Ignore case when looking for components in the component to team data

The case used in the component to team data is not consistent with the actual component names.
As a workaround, we ignore case.

Fixes #2024
This commit is contained in:
Marco Castelluccio 2020-12-14 19:20:29 +01:00
Родитель 67064aba22
Коммит df8d795321
2 изменённых файлов: 19 добавлений и 2 удалений

Просмотреть файл

@ -324,6 +324,8 @@ def component_to_team(
product: str,
component: str,
) -> Optional[str]:
component = component.lower()
for team, products_data in component_team_mapping.items():
if product not in products_data:
continue
@ -331,9 +333,12 @@ def component_to_team(
product_data = products_data[product]
if (
product_data["all_components"]
or component in product_data["named_components"]
or any(
component.startswith(prefix)
component == named_component.lower()
for named_component in product_data["named_components"]
)
or any(
component.startswith(prefix.lower())
for prefix in product_data["prefixed_components"]
)
):

Просмотреть файл

@ -104,6 +104,13 @@ def component_team_mapping():
"prefixed_components": ["GFX", "Graphics"],
}
},
"Javascript": {
"Core": {
"all_components": False,
"named_components": ["js-ctypes"],
"prefixed_components": ["Javascript"],
}
},
}
@ -151,3 +158,8 @@ def test_component_to_team(component_team_mapping: dict) -> None:
bugzilla.component_to_team(component_team_mapping, "Core", "Graphics: OK")
== "GFX"
)
assert (
bugzilla.component_to_team(component_team_mapping, "Core", "JavaScript Engine")
== "Javascript"
)