From f0987ed9b846ba2cd2ad0442ae0179167d298dd0 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Wed, 18 Oct 2017 18:07:04 -0400 Subject: [PATCH] tests: Add more hostkeymap tests --- tests/hostkeymap.py | 22 ++++++++++++-- tests/hostkeymap/console-setup-debian9.txt | 16 ++++++++++ tests/hostkeymap/default-keyboard-debian9.txt | 10 +++++++ tests/hostkeymap/sysconfig-rhel5.txt | 2 ++ tests/hostkeymap/xorg-rhel5.txt | 30 +++++++++++++++++++ 5 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 tests/hostkeymap/console-setup-debian9.txt create mode 100644 tests/hostkeymap/default-keyboard-debian9.txt create mode 100644 tests/hostkeymap/sysconfig-rhel5.txt create mode 100644 tests/hostkeymap/xorg-rhel5.txt diff --git a/tests/hostkeymap.py b/tests/hostkeymap.py index 6447b9949..029085f96 100644 --- a/tests/hostkeymap.py +++ b/tests/hostkeymap.py @@ -25,12 +25,30 @@ class TestHostkeymap(unittest.TestCase): """ Tests for hostkeymap.py file parsing """ + # pylint: disable=protected-access + def testFiles(self): def _open(filename): return file(os.path.join(os.getcwd(), "tests/hostkeymap", filename)) self.assertEquals( - hostkeymap._sysconfig_keyboard(_open("sysconfig-comments.txt")), + hostkeymap._sysconfig_keyboard( + _open("sysconfig-comments.txt")), "") - + self.assertEquals( + hostkeymap._sysconfig_keyboard( + _open("sysconfig-rhel5.txt")), + "us") + self.assertEquals( + hostkeymap._find_xkblayout( + _open("default-keyboard-debian9.txt")), + "us") + self.assertEquals( + hostkeymap._find_xkblayout( + _open("console-setup-debian9.txt")), + None) + self.assertEquals( + hostkeymap._xorg_keymap( + _open("xorg-rhel5.txt")), + "us") diff --git a/tests/hostkeymap/console-setup-debian9.txt b/tests/hostkeymap/console-setup-debian9.txt new file mode 100644 index 000000000..dc3ea7f23 --- /dev/null +++ b/tests/hostkeymap/console-setup-debian9.txt @@ -0,0 +1,16 @@ +# CONFIGURATION FILE FOR SETUPCON + +# Consult the console-setup(5) manual page. + +ACTIVE_CONSOLES="/dev/tty[1-6]" + +CHARMAP="UTF-8" + +CODESET="Lat15" +FONTFACE="Fixed" +FONTSIZE="8x16" + +VIDEOMODE= + +# The following is an example how to use a braille font +# FONT='lat9w-08.psf.gz brl-8x8.psf' diff --git a/tests/hostkeymap/default-keyboard-debian9.txt b/tests/hostkeymap/default-keyboard-debian9.txt new file mode 100644 index 000000000..3fecbcce9 --- /dev/null +++ b/tests/hostkeymap/default-keyboard-debian9.txt @@ -0,0 +1,10 @@ +# KEYBOARD CONFIGURATION FILE + +# Consult the keyboard(5) manual page. + +XKBMODEL="pc105" +XKBLAYOUT="us" +XKBVARIANT="" +XKBOPTIONS="" + +BACKSPACE="guess" diff --git a/tests/hostkeymap/sysconfig-rhel5.txt b/tests/hostkeymap/sysconfig-rhel5.txt new file mode 100644 index 000000000..970189b7b --- /dev/null +++ b/tests/hostkeymap/sysconfig-rhel5.txt @@ -0,0 +1,2 @@ +KEYBOARDTYPE="pc" +KEYTABLE="us" diff --git a/tests/hostkeymap/xorg-rhel5.txt b/tests/hostkeymap/xorg-rhel5.txt new file mode 100644 index 000000000..694f1bc99 --- /dev/null +++ b/tests/hostkeymap/xorg-rhel5.txt @@ -0,0 +1,30 @@ +# Xorg configuration created by pyxf86config + +Section "ServerLayout" + Identifier "Default Layout" + Screen 0 "Screen0" 0 0 + InputDevice "Keyboard0" "CoreKeyboard" +EndSection + +Section "InputDevice" + Identifier "Keyboard0" + Driver "kbd" + Option "XkbModel" "pc105" + Option "XkbLayout" "us" +EndSection + +Section "Device" + Identifier "Videocard0" + Driver "vesa" +EndSection + +Section "Screen" + Identifier "Screen0" + Device "Videocard0" + DefaultDepth 24 + SubSection "Display" + Viewport 0 0 + Depth 24 + EndSubSection +EndSection +