def test_handle_connection_errors(self, exception_type) -> None:

        check = Mpd("test", None, None, None)  # type: ignore

        def _get_state():
            raise exception_type()

        check._get_state = _get_state  # type: ignore

        with pytest.raises(TemporaryCheckError):
            check.check()
Ejemplo n.º 2
0
    def test_handle_connection_errors(self):

        check = Mpd('test', None, None, None)

        def _get_state():
            raise ConnectionError()

        check._get_state = _get_state

        with pytest.raises(TemporaryCheckError):
            check.check()
Ejemplo n.º 3
0
    def test_not_playing(self, monkeypatch):

        check = Mpd('test', None, None, None)

        def get_state():
            return {'state': 'pause'}
        monkeypatch.setattr(check, '_get_state', get_state)

        assert check.check() is None
    def test_not_playing(self, monkeypatch) -> None:

        check = Mpd("test", None, None, None)  # type: ignore

        def get_state():
            return {"state": "pause"}

        monkeypatch.setattr(check, "_get_state", get_state)

        assert check.check() is None