7
from testutils import setup_test_env
9
from softwarecenter.hw import (
10
get_hardware_support_for_tags,
11
get_hw_missing_long_description,
12
OPENGL_DRIVER_BLACKLIST_TAG)
14
class TestHW(unittest.TestCase):
15
""" tests the hardware support detection """
17
def test_get_hardware_support_for_tags(self):
18
tags = [OPENGL_DRIVER_BLACKLIST_TAG + "intel",
19
"hardware::input:mouse",
21
with patch("debtagshw.opengl.get_driver") as mock_get_driver:
22
# test with the intel driver
23
mock_get_driver.return_value = "intel"
24
supported = get_hardware_support_for_tags(tags)
25
self.assertEqual(supported[tags[0]], "no")
26
self.assertEqual(len(supported), 2)
27
# now with fake amd driver
28
mock_get_driver.return_value = "amd"
29
supported = get_hardware_support_for_tags(tags)
30
self.assertEqual(supported[tags[0]], "yes")
32
def test_get_hw_missing_long_description(self):
33
s = get_hw_missing_long_description(
34
{ "hardware::input:keyboard": "yes",
35
OPENGL_DRIVER_BLACKLIST_TAG + "intel": "no",
37
self.assertEqual(s, 'This computer uses a "intel" video driver, '
38
'but the application is not compatible with that.')
41
if __name__ == "__main__":
43
#logging.basicConfig(level=logging.DEBUG)