Exemple #1
0
    def test_notify(self):
        client = FakeClient()
        system = SystemControl(client)
        system.notify("test", block=False)

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://system.notifications/createToast",
            "payload": {"message": "test"}
        })
Exemple #2
0
    def test_enter(self):
        client = FakeClient()
        inp = InputControl(client)

        inp.enter(block=False)

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://com.webos.service.ime/sendEnterKey",
        })
Exemple #3
0
    def test_set_volume(self):
        client = FakeClient()
        media = MediaControl(client)
        media.set_volume(30, block=False)

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setVolume",
            "payload": {"volume": 30}
        })
Exemple #4
0
    def test_unmute(self):
        client = FakeClient()
        media = MediaControl(client)
        media.mute(False, block=False)

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://audio/setMute",
            "payload": {"mute": False}
        })
Exemple #5
0
    def test_delete(self):
        client = FakeClient()
        inp = InputControl(client)

        inp.delete(4, block=False)

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://com.webos.service.ime/deleteCharacters",
            "payload": {
                "count": 4,
            }
        })
Exemple #6
0
    def test_type(self):
        client = FakeClient()
        inp = InputControl(client)

        inp.type("hello world", block=False)

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://com.webos.service.ime/insertText",
            "payload": {
                "text": "hello world",
                "replace": 0,
            }
        })
Exemple #7
0
    def test_close(self):
        client = FakeClient()
        app = ApplicationControl(client)

        client.setup_response("ssap://system.launcher/close",
                              {"returnValue": True})
        app.close({"123": "435"})

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://system.launcher/close",
            "payload": {
                "123": "435",
            }
        })
Exemple #8
0
    def test_launch(self):
        client = FakeClient()
        app = ApplicationControl(client)

        client.setup_response("ssap://system.launcher/launch",
                              {"returnValue": True})
        application = Application({"id": "123"})
        app.launch(application, content_id="1", params={"a": "b"})

        client.assert_sent_message_without_id({
            "type": "request",
            "uri": "ssap://system.launcher/launch",
            "payload": {
                "id": "123",
                "contentId": "1",
                "params": {"a": "b"}
            }
        })
Exemple #9
0
    def test_commands(self, command, uri):
        client = FakeClient()
        system = SystemControl(client)
        getattr(system, command)(block=False)

        client.assert_sent_message_without_id({"type": "request", "uri": uri})