How to use pywebostv - 10 common examples

To help you get started, we’ve selected a few pywebostv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_unmute(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.mute(False)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": False}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def set_volume(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.set_volume(30)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setVolume",
            "payload": {"volume": 30}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_mute(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.mute(True)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": True}
        })
github supersaiyanmode / PyWebOSTV / tests / test_connection.py View on Github external
}))
            return send_response

        def patched_send_message(*args, **kwargs):
            kwargs["unique_id"] = "1"
            obj = WebOSClient.send_message(client, *args, **kwargs)
            sent_event.set()
            return obj

        client.send_message = patched_send_message

        store = {}
        Thread(target=make_response(True, True, False)).start()
        gen = client.register(store, timeout=10)
        assert next(gen) == WebOSClient.PROMPTED
        assert next(gen) == WebOSClient.REGISTERED

        assert store == {"client_key": "xyz"}

        # Test with non-empty store.
        Thread(target=make_response(False, True, False)).start()
        assert list(client.register(store, timeout=10)) ==\
            [WebOSClient.REGISTERED]
        assert "xyz" in json.dumps(client.sent_message)

        # Test wrong response.
        Thread(target=make_response(False, False, True)).start()
        with raises(Exception):
            list(client.register(store, timeout=10))
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_volume_down(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.volume_down()

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/volumeDown"
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_mute(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.mute(True)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": True}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_volume_down(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.volume_down()

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/volumeDown"
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def set_volume(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.set_volume(30)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setVolume",
            "payload": {"volume": 30}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_unmute(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.mute(False)

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": False}
        })
github supersaiyanmode / PyWebOSTV / tests / test_controls.py View on Github external
def test_volume_up(self):
        client = WebOSClient("ws://a")
        media = MediaControl(client)
        media.volume_up()

        self.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/volumeUp"
        })