def test_windows_fake(self, monkeypatch): """Test with a fake Windows.""" monkeypatch.setattr("qutebrowser.utils.version.sys.platform", "win32") monkeypatch.setattr("qutebrowser.utils.version.platform.win32_ver", lambda: ("eggs", "bacon", "ham", "spam")) ret = version._os_info() expected = ["OS Version: eggs, bacon, ham, spam"] assert ret == expected
def test_posix_fake(self, monkeypatch): """Test with a fake posix platform.""" uname_tuple = ('PosixOS', 'localhost', '1.0', '1.0', 'i386', 'i386') monkeypatch.setattr(version.platform, 'uname', lambda: uname_tuple) ret = version._os_info() expected = ['OS Version: PosixOS localhost 1.0 1.0 i386 i386'] assert ret == expected
def test_unknown_fake(self, monkeypatch): """Test with a fake unknown sys.platform.""" monkeypatch.setattr('qutebrowser.utils.version.sys.platform', 'toaster') ret = version._os_info() expected = ['OS Version: ?'] assert ret == expected
def test_windows_fake(self, monkeypatch): """Test with a fake Windows.""" monkeypatch.setattr(version.platform, 'win32_ver', lambda: ('eggs', 'bacon', 'ham', 'spam')) ret = version._os_info() expected = ['OS Version: eggs, bacon, ham, spam'] assert ret == expected
def test_linux_fake(self, monkeypatch): """Test with a fake Linux. No args because osver is set to '' if the OS is linux. """ monkeypatch.setattr("qutebrowser.utils.version.sys.platform", "linux") monkeypatch.setattr("qutebrowser.utils.version._release_info", lambda: [("releaseinfo", "Hello World")]) ret = version._os_info() expected = ["OS Version: ", "", "--- releaseinfo ---", "Hello World"] assert ret == expected
def test_linux_fake(self, monkeypatch): """Test with a fake Linux. No args because osver is set to '' if the OS is linux. """ monkeypatch.setattr(version, '_release_info', lambda: [('releaseinfo', 'Hello World')]) ret = version._os_info() expected = ['OS Version: ', '', '--- releaseinfo ---', 'Hello World'] assert ret == expected
def test_mac_fake(self, monkeypatch, mac_ver, mac_ver_str): """Test with a fake macOS. Args: mac_ver: The tuple to set platform.mac_ver() to. mac_ver_str: The expected Mac version string in version._os_info(). """ monkeypatch.setattr(version.platform, 'mac_ver', lambda: mac_ver) ret = version._os_info() expected = ['OS Version: {}'.format(mac_ver_str)] assert ret == expected
def test_os_x_fake(self, monkeypatch, mac_ver, mac_ver_str): """Test with a fake OS X. Args: mac_ver: The tuple to set platform.mac_ver() to. mac_ver_str: The expected Mac version string in version._os_info(). """ monkeypatch.setattr("qutebrowser.utils.version.sys.platform", "darwin") monkeypatch.setattr("qutebrowser.utils.version.platform.mac_ver", lambda: mac_ver) ret = version._os_info() expected = ["OS Version: {}".format(mac_ver_str)] assert ret == expected
def test_linux_fake(self, monkeypatch, dist, dist_str): """Test with a fake Linux. Args: dist: The value to set platform.dist() to. dist_str: The expected distribution string in version._os_info(). """ monkeypatch.setattr('qutebrowser.utils.version.sys.platform', 'linux') monkeypatch.setattr('qutebrowser.utils.version._release_info', lambda: [('releaseinfo', 'Hello World')]) monkeypatch.setattr('qutebrowser.utils.version.platform.dist', lambda: dist) ret = version._os_info() expected = ['OS Version: {}'.format(dist_str), '', '--- releaseinfo ---', 'Hello World'] assert ret == expected
def test_linux_real(self): """Make sure there are no exceptions with a real Linux.""" version._os_info()
def test_posix_real(self): """Make sure there are no exceptions with a real posix.""" version._os_info()
def test_mac_real(self): """Make sure there are no exceptions with a real macOS.""" version._os_info()
def test_unknown_fake(self): """Test with a fake unknown platform.""" ret = version._os_info() expected = ['OS Version: ?'] assert ret == expected
def test_windows_real(self): """Make sure there are no exceptions with a real Windows.""" version._os_info()
def test_os_x_real(self): """Make sure there are no exceptions with a real OS X.""" version._os_info()
def test_unknown_fake(self, monkeypatch): """Test with a fake unknown sys.platform.""" monkeypatch.setattr(version.sys, 'platform', 'toaster') ret = version._os_info() expected = ['OS Version: ?'] assert ret == expected