File: test_validate_ping.py

package info (click to toggle)
glean-parser 15.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,260 kB
  • sloc: python: 7,033; ruby: 100; makefile: 87
file content (44 lines) | stat: -rw-r--r-- 1,298 bytes parent folder | download
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
# -*- coding: utf-8 -*-

# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

import io
import json
import pytest
from pytest import raises

from glean_parser import validate_ping


@pytest.mark.web_dependency
def test_validate_ping():
    content = {
        "experiments": {
            "experiment2": {"branch": "branch_b", "extra": {"key": "value"}}
        },
        "metrics": {"string": {"telemetry.string_metric": "foo"}},
        "ping_info": {
            "ping_type": "metrics",
            "telemetry_sdk_build": "0.32.0",
            "seq": 0,
            "app_build": "test-placeholder",
            "client_id": "900b6d8c-34d2-44d4-926d-83bde790474f",
            "start_time": "2018-11-19T16:19-05:00",
            "end_time": "2018-11-19T16:19-05:00",
        },
    }

    input = io.StringIO(json.dumps(content))
    output = io.StringIO()

    schema_url = (
        "https://raw.githubusercontent.com/mozilla-services/"
        "mozilla-pipeline-schemas/3a15121c582ef0cffe430da024a5bf11b7c48740/"
        "schemas/glean/baseline/baseline.1.schema.json"
    )

#    assert validate_ping.validate_ping(input, output, schema_url=schema_url) == 0

#    with raises(TypeError):
#        validate_ping.validate_ping(input, output)