virt-manager/tests/hostkeymap.py

43 lines
1.2 KiB
Python
Raw Normal View History

# Copyright (C) 2017 Red Hat, Inc.
#
# This work is licensed under the GNU GPLv2 or later.
# See the COPYING file in the top-level directory.
import os
import unittest
from virtinst import hostkeymap
class TestHostkeymap(unittest.TestCase):
"""
Tests for hostkeymap.py file parsing
"""
2017-10-18 18:07:04 -04:00
# pylint: disable=protected-access
def testFiles(self):
def _open(filename):
return open(os.path.join(os.getcwd(),
"tests/hostkeymap", filename))
self.assertEqual(
2017-10-18 18:07:04 -04:00
hostkeymap._sysconfig_keyboard(
_open("sysconfig-comments.txt")),
"")
self.assertEqual(
2017-10-18 18:07:04 -04:00
hostkeymap._sysconfig_keyboard(
_open("sysconfig-rhel5.txt")),
"us")
self.assertEqual(
2017-10-18 18:07:04 -04:00
hostkeymap._find_xkblayout(
_open("default-keyboard-debian9.txt")),
"us")
self.assertEqual(
2017-10-18 18:07:04 -04:00
hostkeymap._find_xkblayout(
_open("console-setup-debian9.txt")),
None)
self.assertEqual(
2017-10-18 18:07:04 -04:00
hostkeymap._xorg_keymap(
_open("xorg-rhel5.txt")),
"us")