From: Alexander Popov Date: Fri, 10 Mar 2023 20:12:58 +0000 (+0300) Subject: Add a template for unit-tests X-Git-Tag: v0.6.6~220 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=f08db00f97baf8004863be191c89285ad6c333f5;p=kconfig-hardened-check.git Add a template for unit-tests --- 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())