From 85c0d2f50fc2ddf7e34e8e6a045e42af26eee85c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Mon, 13 May 2024 16:53:08 +0200 Subject: [PATCH] Add tests to eol testing --- qui/eol.json | 2 +- qui/updater/tests/test_utils.py | 52 +++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 qui/updater/tests/test_utils.py diff --git a/qui/eol.json b/qui/eol.json index 897a2a11..3fbd3f35 100644 --- a/qui/eol.json +++ b/qui/eol.json @@ -1,5 +1,5 @@ { -"fedora-37": "2024-12-23", +"fedora-37": "2023-12-23", "fedora-36": "2023-05-16", "fedora-35": "2022-12-13", "fedora-34": "2022-06-07", diff --git a/qui/updater/tests/test_utils.py b/qui/updater/tests/test_utils.py new file mode 100644 index 00000000..54d5b561 --- /dev/null +++ b/qui/updater/tests/test_utils.py @@ -0,0 +1,52 @@ +# -*- encoding: utf8 -*- +# +# The Qubes OS Project, http://www.qubes-os.org +# +# Copyright (C) 2022 Marta Marczykowska-Górecka +# +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License along +# with this program; if not, see . +from qui.utils import check_support +from qubesadmin.tests.mock_app import MockQubes, MockQube + +def test_check_support(): + qapp = MockQubes() + vm_supported = MockQube("test-qube-1", qapp, + features={"os-eol": "2060-01-01"}) + vm_not_supported = MockQube("test-qube-2", qapp, + features={"os-eol": "1990-01-01"}) + fedora_min = MockQube("test-qube-3", qapp, + features={"template-name": "fedora-36-minimal"}) + fedora_xfce = MockQube("test-qube-4", qapp, + features={"template-name": "fedora-35-xfce"}) + wrong_name = MockQube("test-qube-5", qapp, + features={"template-name": "faedora-66"}) + debian_minimal = MockQube("test-qube-6", qapp, + features={"template-name": "debian-9-minimal"}) + normal_debian = MockQube("test-qube-7", qapp, + features={"template-name": "debian-8"}) + nothing_special = MockQube("test-qube-8", qapp) + + qapp.update_vm_calls() + + assert check_support(vm_supported) + assert not check_support(vm_not_supported) + + assert not check_support(fedora_min) + assert not check_support(fedora_xfce) + assert check_support(wrong_name) + assert not check_support(debian_minimal) + assert not check_support(normal_debian) + assert check_support(nothing_special) +