Пример #1
0
 def test_smoke(self):
     check = LogindSessionsIdle(
         'test', ['tty', 'x11', 'wayland'], ['active', 'online'])
     assert check._types == ['tty', 'x11', 'wayland']
     assert check._states == ['active', 'online']
     try:
         # only run the test if the dbus module is available (not on travis)
         import dbus  # noqa: F401
         check.check()
     except ImportError:
         pass
 def test_configure_states(self) -> None:
     parser = configparser.ConfigParser()
     parser.read_string(
         """
         [section]
         states=test, bla,foo
         """
     )
     check = LogindSessionsIdle.create("name", parser["section"])
     assert check._states == ["test", "bla", "foo"]
    def test_dbus_error(self, logind_dbus_error) -> None:
        check = LogindSessionsIdle("test", ["test"], ["active", "online"])

        with pytest.raises(TemporaryCheckError):
            check.check()
 def test_configure_defaults(self) -> None:
     parser = configparser.ConfigParser()
     parser.read_string("[section]")
     check = LogindSessionsIdle.create("name", parser["section"])
     assert check._types == ["tty", "x11", "wayland"]
     assert check._states == ["active", "online"]
    def test_ignore_unknow_type(self, logind) -> None:
        logind.AddSession("c1", "seat0", 1042, "auser", True)

        check = LogindSessionsIdle("test", ["not_test"], ["active", "online"])
        check.check() is None
    def test_inactive(self, logind) -> None:
        logind.AddSession("c1", "seat0", 1042, "auser", False)

        check = LogindSessionsIdle("test", ["test"], ["active", "online"])
        check.check() is None
 def create_instance(self, name):
     return LogindSessionsIdle(name, ["tty", "x11", "wayland"], ["active", "online"])
Пример #8
0
 def test_configure_types(self):
     parser = configparser.ConfigParser()
     parser.read_string('''[section]
                        types=test, bla,foo''')
     check = LogindSessionsIdle.create('name', parser['section'])
     assert check._types == ['test', 'bla', 'foo']
Пример #9
0
 def test_configure_defaults(self):
     parser = configparser.ConfigParser()
     parser.read_string('[section]')
     check = LogindSessionsIdle.create('name', parser['section'])
     assert check._types == ['tty', 'x11', 'wayland']
     assert check._states == ['active', 'online']
Пример #10
0
 def create_instance(self, name):
     return LogindSessionsIdle(
         name, ['tty', 'x11', 'wayland'], ['active', 'online'])