def test_jsonschema_valitate_failure(files): class BadTransformer: def transform(self, data): return {"bad data": "bad data"} def merge(self, sde): return {"bad data": "bad data"} files = files["resources"] file_1 = files["file_1"] file_2 = files["file_2"] tfm = Transformer([], BadTransformer(), logger=metadata, prefix=prefix) tfm.files = [file_1, file_2] with pytest.raises(ValidationError): tfm.process("name")
def test_process(files): files = files["resources"] file_1 = files["file_1"] file_2 = files["file_2"] tfm = Transformer([], SingleJsonRetriever()) tfm.files = [file_1, file_2] expected_result = [{ "data": [ { "value": 101, "xaxis": 1, "file": file_1 }, { "value": 102, "xaxis": 1, "file": file_1 }, { "value": 103, "xaxis": 1, "file": file_1 }, { "value": 201, "xaxis": 2, "file": file_2 }, { "value": 202, "xaxis": 2, "file": file_2 }, { "value": 203, "xaxis": 2, "file": file_2 }, ], "subtest": "browserScripts.timings.firstPaint", "name": "group_1", }] actual_result = tfm.process("group_1") assert actual_result == expected_result