From f08db00f97baf8004863be191c89285ad6c333f5 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Fri, 10 Mar 2023 23:12:58 +0300 Subject: [PATCH] Add a template for unit-tests --- .github/workflows/main.yml | 5 +++++ kconfig_hardened_check/test_engine.py | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 kconfig_hardened_check/test_engine.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4f543d0..eb1a8dd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -170,3 +170,8 @@ jobs: run: | coverage erase rm ./coverage.xml + + - name: Run unit-tests and collect coverage + run: | + coverage run --include=kconfig_hardened_check/engine.py,kconfig_hardened_check/test_engine.py -m unittest -v + coverage xml -i -o coverage_unittest.xml diff --git a/kconfig_hardened_check/test_engine.py b/kconfig_hardened_check/test_engine.py new file mode 100644 index 0000000..ca6698f --- /dev/null +++ b/kconfig_hardened_check/test_engine.py @@ -0,0 +1,22 @@ +#!/usr/bin/python3 + +""" +This tool helps me to check Linux kernel options against +my security hardening preferences for X86_64, ARM64, X86_32, and ARM. +Let the computers do their job! + +Author: Alexander Popov + +This module performs unit-testing of the kconfig-hardened-check engine. +""" + +import unittest +# from .engine import populate_with_data, perform_checks + +class TestEngine(unittest.TestCase): + def test_upper(self): + self.assertEqual('foo'.upper(), 'FOO') + + def test_isupper(self): + self.assertTrue('FOO'.isupper()) + self.assertTrue('Foo'.isupper()) -- 2.31.1