def test_display_settings(): """ Summary including library version information is returned. """ display_name = 'Awesome display' class DisplaySettingsConfig(object): display = display_name interface = 'USB' width = 120 height = 80 with patch('luma.core.cmdline.get_display_types') as mocka: mocka.return_value = { 'superhdscreenz': [display_name, 'amazingscreen'], 'emulator': ['x', 'y'] } # set version nr for fake luma.superhdscreenz module luma_fake_lib = Mock() luma_fake_lib.__version__ = '1.2.3' with patch.dict('sys.modules', {'luma.superhdscreenz': luma_fake_lib}): result = display_settings(DisplaySettingsConfig()) assert result == """Version: luma.superhdscreenz 1.2.3 (luma.core 4.5.6)
def test_display_settings(): """ Summary is returned. """ class foo(object): display = 'foo' interface = 'bar' width = 100 height = 50 result = display_settings(foo()) assert result == """Display: foo