def test_replace_all_errors(): s = fake.session() project = fake.mastering_project() transforms = fake.transforms() with pytest.raises(HTTPError): tc.transformations.replace_all(s, project, transforms)
def test_from_project(): s = fake.session() project = fake.mastering_project() unified_dataset = tc.dataset.unified.from_project(s, project) assert unified_dataset.name == "dataset 1 name" assert unified_dataset.description == "dataset 1 description" assert unified_dataset.key_attribute_names == ("tamr_id",)
def test_replace_all(): s = fake.session() project = fake.mastering_project() transforms = fake.transforms() transforms.unified_scope.append("//extra TX") transforms.input_scope.pop(1) tc.transformations.replace_all(s, project, transforms)
def test_from_project_dataset_not_found(): s = fake.session() instance = fake.instance() project = fake.mastering_project() url = tc.URL(path="projects/1/unifiedDataset") responses.add(responses.GET, str(url), status=404) with pytest.raises(tc.dataset.unified.NotFound): tc.dataset.unified.from_project(s, instance, project)
def test_update_cluster_results_async(): s = fake.session() project = fake.mastering_project() op = tc.mastering._update_cluster_results_async(s, project) assert op.type == "SPARK" assert op.description == "Materialize views to Elastic" assert op.status == { "state": "PENDING", "startTime": "", "endTime": "", "message": "Job has not yet been submitted to Spark", }
def test_estimate_pairs_async(): s = fake.session() project = fake.mastering_project() op = tc.mastering._estimate_pairs_async(s, project) assert op.type == "SPARK" assert op.description == "operation 1 description" assert op.status == { "state": "PENDING", "startTime": "", "endTime": "", "message": "Job has not yet been submitted to Spark", }
def test_from_project(): s = fake.session() instance = fake.instance() project = fake.mastering_project() dataset_json = utils.load_json("dataset.json") url = tc.URL(path="projects/1/unifiedDataset") responses.add(responses.GET, str(url), json=dataset_json) unified_dataset = tc.dataset.unified.from_project(s, instance, project) assert unified_dataset.name == "dataset 1 name" assert unified_dataset.description == "dataset 1 description" assert unified_dataset.key_attribute_names == ("tamr_id", )
def test_get_all(): s = fake.session() project = fake.mastering_project() transforms = tc.transformations.get_all(s, project) assert len(transforms.input_scope) == 2 assert len(transforms.unified_scope) == 1 assert len(transforms.input_scope[0].datasets) == 0 assert transforms.input_scope[0].transformation == "SELECT *, 1 as one;" assert len(transforms.input_scope[1].datasets) == 1 assert transforms.input_scope[1].datasets[0].name == "dataset 1 name" assert transforms.input_scope[1].transformation == "SELECT *, 2 as two;" assert transforms.unified_scope[0] == "//Comment\nSELECT *;"
def test_from_project_dataset_not_found(): s = fake.session() project = fake.mastering_project() with pytest.raises(tc.dataset.unified.NotFound): tc.dataset.unified.from_project(s, project)