~aleteoryx/muditaos

ref: cdfadba379aec85a359096648b01a5493cc7e3f6 muditaos/test/pytest/service-desktop/test_update.py -rw-r--r-- 733 bytes
cdfadba3 — Bartosz Cichocki [EGD-4510] testing: added pytest tests, updated documentation (#1096) 5 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
# Copyright (c) 2017-2020, 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.service_desktop_test
def test_update(harness):
    body = {}
    ret = harness.endpoint_request("update", "get", body)
    assert ret["status"] == status["OK"]

    file_list = ret["body"]["updateFileList"]

    if len(file_list) == 0:
        pytest.skip("No update files")

    for file in file_list:
        assert file["size"] != 0

    body = {"filename": file_list[0]["name"]}
    ret = harness.endpoint_request("update", "post", body)
    assert ret["status"] == status["OK"]
    assert ret["body"]["updateReady"] is True