From 900988e5ce4244d81a93e9da2a7df7a7e45d2042 Mon Sep 17 00:00:00 2001 From: Ambika Nair Date: Thu, 18 Jun 2020 17:22:00 -0400 Subject: [PATCH] Replicated kernel module unittest with pytest --- pytests/modules/__init__.py | 0 pytests/modules/contrib/__init__.py | 0 pytests/modules/contrib/test_kernel.py | 20 ++++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 pytests/modules/__init__.py create mode 100644 pytests/modules/contrib/__init__.py create mode 100644 pytests/modules/contrib/test_kernel.py diff --git a/pytests/modules/__init__.py b/pytests/modules/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pytests/modules/contrib/__init__.py b/pytests/modules/contrib/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/pytests/modules/contrib/test_kernel.py b/pytests/modules/contrib/test_kernel.py new file mode 100644 index 0000000..69a7ba9 --- /dev/null +++ b/pytests/modules/contrib/test_kernel.py @@ -0,0 +1,20 @@ +import pytest + +import core.config +import modules.contrib.kernel + +@pytest.fixture +def some_kernel(): + return "this-is-my-kernel" + +@pytest.fixture +def kernel_module(): + return modules.contrib.kernel.Module(config=core.config.Config([]), theme=None) + +def test_full_text(mocker, kernel_module): + platform = mocker.patch('modules.contrib.kernel.platform') + platform.release.return_value = some_kernel + assert len(kernel_module.widgets()) == 1 + assert some_kernel == kernel_module.widget().full_text() + +# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4