~aleteoryx/muditaos

ref: 7bcc1c9bd4add82ca6d53aa22e12e620551ba172 muditaos/test/pytest/service-desktop/test_connection_security.py -rw-r--r-- 1.3 KiB
7bcc1c9b — Lucjan Bryndza [EGD-6013] Fix no copy syscall 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
import pytest
import time
from harness.interface.defs import status
from harness import utils, log

@pytest.mark.service_desktop_test
@pytest.mark.usefixtures("usb_locked")
@pytest.mark.skip("not working ;/")
def test_secured_endpoint(harness):
    body = {}

    ret = harness.endpoint_request("deviceInfo", "get", body)
    assert ret["status"] == status["Forbidden"]

    ret = harness.endpoint_request("messages", "get", body)
    assert ret["status"] == status["Forbidden"]

    ret = harness.endpoint_request("calllog", "get", body)
    assert ret["status"] == status["Forbidden"]

    ret = harness.endpoint_request("backup", "get", body)
    assert ret["status"] == status["Forbidden"]

    ret = harness.endpoint_request("contacts", "get", body)
    assert ret["status"] == status["Forbidden"]

    harness.unlock_usb()

    ret = harness.endpoint_request("deviceInfo", "get", body)
    assert ret["status"] == status["OK"]

    ret = harness.endpoint_request("calllog", "get", body)
    assert ret["status"] == status["OK"]

    ret = harness.endpoint_request("backup", "get", body)
    assert ret["status"] == status["BadRequest"]

    ret = harness.endpoint_request("contacts", "get", body)
    assert ret["status"] == status["OK"]