Exemplo n.º 1
0
def client_to_existing_content(running_server):
    client = ServerClient(running_server)

    client.post_point(
        "f-score",
        Point.create(0.72, timestamp=FIXED_TIMESTAMP),
    )
    client.post_point(
        "f-score",
        Point.create(0.75, timestamp=FIXED_TIMESTAMP),
    )

    client.post_point(
        "cost",
        Point.create(19.0, params={"team": "vege"}),
    )
    client.post_point(
        "cost",
        Point.create(20.0, params={"team": "burgery"}),
    )
    client.post_point(
        "cost",
        Point.create(20, params={"team": "vege"}),
    )

    first_view = [
        ChartConfig(metric_id="cost",
                    x_accessor="timestamp",
                    restrictions={"team": "vege"}),
        ChartConfig(metric_id="cost",
                    x_accessor="timestamp",
                    restrictions={"team": "burgery"}),
    ]

    client._post_view("sample-view", first_view)
    client._post_view(
        "sample-view",
        [
            *first_view,
            ChartConfig(metric_id="cost",
                        x_accessor="timestamp",
                        restrictions={"team": "olimp"}),
        ],
    )

    return client
Exemplo n.º 2
0
        "sample-view",
        [
            *first_view,
            ChartConfig(metric_id="cost",
                        x_accessor="timestamp",
                        restrictions={"team": "olimp"}),
        ],
    )

    return client


@pytest.mark.parametrize(
    "p, json_str",
    [
        (Point.create(0.5), """{"value": 0.5, "params": {}}"""),
        (
            Point.create(1, params={"team": "vege"}),
            """{"value": 1.0, "params": {"team": "vege"}}""",
        ),
        (
            Point.create(1, version="1.2.0"),
            """{"value": 1.0, "params": {}, "version": [1, 2, 0]}""",
        ),
        (
            Point.create(1, version="2012.5.12"),
            """{"value": 1.0, "params": {}, "version": [2012, 5, 12]}""",
        ),
        (
            Point.create(1, timestamp=FIXED_TIMESTAMP),
            """{"value": 1.0, "params": {}, "timestamp": "%s"}""" %