~aleteoryx/muditaos

ref: 0e8b4c848e3f87f3bbb1f64ef7460cf56017b87f muditaos/test/pytest/service-desktop/test_calllog.py -rw-r--r-- 1.7 KiB
0e8b4c84 — Lefucjusz [BH-2108] Fix misaligned charging symbol 3 months 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
42
43
44
45
46
47
48
49
50
51
52
# Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
import pytest
from harness.interface.defs import status


@pytest.mark.skip(reason="This test should be refactored after calllog EP API final design will be ready")
@pytest.mark.service_desktop_test
@pytest.mark.usefixtures("phone_unlocked")
def test_calllog(harness):
    # checking call log count
    body = {"count": True}
    ret = harness.endpoint_request("calllog", "get", body)
    assert ret["status"] == status["OK"]

    count = ret["body"]["count"]
    if count == 0:
        pytest.skip("No calllog entries, skipping")

    # getting the whole call log
    body = {"limit": count}
    ret = harness.endpoint_request("calllog", "get", body)
    assert ret["status"] == status["OK"]

    calllog = ret["body"]
    assert len(calllog)
    contact_id = calllog[0]["contactId"]

    for record in calllog:
        assert record["phoneNumber"].replace('+', '').isnumeric()
        assert record["date"].isnumeric()
        assert record["duration"].isnumeric()

    # getting exact call log
    body = {"contactID": contact_id}
    ret = harness.endpoint_request("calllog", "get", body)
    assert ret["status"] == status["OK"]

    for log in ret["body"]:
        assert log["contactId"] == contact_id

    # remove exact call log
    body = {"id": calllog[0]["id"]}
    ret = harness.endpoint_request("calllog", "del", body)
    assert ret["status"] == status["NoContent"]

    # getting the count again
    body = {"count": True}
    ret = harness.endpoint_request("calllog", "get", body)
    assert ret["status"] == status["OK"]

    assert count == ret["body"]["count"] + 1