Esempio n. 1
0
def test_transform(data):
    tfm = SingleJsonRetriever()

    expected_result = [{
        "data": [
            {
                "value": 101,
                "xaxis": 1
            },
            {
                "value": 102,
                "xaxis": 1
            },
            {
                "value": 103,
                "xaxis": 1
            },
        ],
        "subtest":
        "browserScripts.timings.firstPaint",
    }]

    actual_result = tfm.transform(data["data_1"])

    assert actual_result == expected_result
Esempio n. 2
0
def test_merge(data):
    tfm = SingleJsonRetriever()
    sde = tfm.transform(data["data_1"])
    sde.extend(tfm.transform(data["data_2"]))

    expected_result = [{
        "data": [
            {
                "value": 101,
                "xaxis": 1
            },
            {
                "value": 102,
                "xaxis": 1
            },
            {
                "value": 103,
                "xaxis": 1
            },
            {
                "value": 201,
                "xaxis": 2
            },
            {
                "value": 202,
                "xaxis": 2
            },
            {
                "value": 203,
                "xaxis": 2
            },
        ],
        "subtest":
        "browserScripts.timings.firstPaint",
    }]

    actual_result = tfm.merge(sde)

    assert actual_result == expected_result