1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-13 11:29:46 +03:00

test: Move test_devices to where it should be

Consequence of tests being moved back and forth over time.

Fixes cd672222c4

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2616
This commit is contained in:
Newbyte 2025-06-03 12:49:07 +02:00 committed by Oliver Smith
parent 4dd820756f
commit 7035c0239d
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -0,0 +1,26 @@
# Copyright 2025 Stefan Hansson
# SPDX-License-Identifier: GPL-3.0-or-later
from pmb.helpers.devices import DeviceCategory, get_device_category_by_apkbuild_path
from pathlib import Path
import pytest
def test_get_device_category_by_apkbuild_path() -> None:
valid_path_1 = Path("device") / "community" / "device-samsung-m0" / "APKBUILD"
valid_path_2 = Path("pmos_work") / "device" / "main" / "device-pine64-pinephone" / "APKBUILD"
# Missing category segment of path.
invalid_path_1 = Path("APKBUILD")
# Nonexistent category ("pendeltåg").
invalid_path_2 = Path("device") / "pendeltåg" / "device-samsung-m0" / "APKBUILD"
assert get_device_category_by_apkbuild_path(valid_path_1) == DeviceCategory.COMMUNITY
assert get_device_category_by_apkbuild_path(valid_path_2) == DeviceCategory.MAIN
with pytest.raises(RuntimeError):
get_device_category_by_apkbuild_path(invalid_path_1)
with pytest.raises(RuntimeError):
get_device_category_by_apkbuild_path(invalid_path_2)