Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_print_validation_result_should_work():
printer.print_validation_result(passed=True, source="model.explore")
printer.print_validation_result(passed=False, source="model.explore")
def test_print_validation_result_should_work():
printer.print_validation_result(passed=True, source="model.explore")
printer.print_validation_result(passed=False, source="model.explore")
base_url,
project,
branch,
client_id,
client_secret,
port,
api_version,
remote_reset,
import_projects,
commit_ref,
)
results = runner.validate_content(explores, excludes, incremental, exclude_personal)
for test in sorted(results["tested"], key=lambda x: (x["model"], x["explore"])):
message = f"{test['model']}.{test['explore']}"
printer.print_validation_result(passed=test["passed"], source=message)
errors = sorted(
results["errors"],
key=lambda x: (x["model"], x["explore"], x["metadata"]["field_name"]),
)
if errors:
for error in errors:
printer.print_content_error(
error["model"],
error["explore"],
error["message"],
error["metadata"]["content_type"],
error["metadata"]["space"],
error["metadata"]["title"],
error["metadata"]["url"],
)
api_version,
remote_reset,
import_projects,
commit_ref,
)
def iter_errors(lookml: List) -> Iterable:
for item in lookml:
if item.errored:
yield item
results = runner.validate_sql(explores, exclude, mode, concurrency)
for test in sorted(results["tested"], key=lambda x: (x["model"], x["explore"])):
message = f"{test['model']}.{test['explore']}"
printer.print_validation_result(passed=test["passed"], source=message)
errors = sorted(
results["errors"],
key=lambda x: (x["model"], x["explore"], x["metadata"].get("dimension")),
)
if errors:
for error in errors:
printer.print_sql_error(
model=error["model"],
explore=error["explore"],
message=error["message"],
sql=error["metadata"]["sql"],
log_dir=log_dir,
dimension=error["metadata"].get("dimension"),
lookml_url=error["metadata"].get("lookml_url"),
base_url,
project,
branch,
client_id,
client_secret,
port,
api_version,
remote_reset,
import_projects,
commit_ref,
)
results = runner.validate_data_tests(explores, exclude)
for test in sorted(results["tested"], key=lambda x: (x["model"], x["explore"])):
message = f"{test['model']}.{test['explore']}"
printer.print_validation_result(passed=test["passed"], source=message)
errors = sorted(
results["errors"],
key=lambda x: (x["model"], x["explore"], x["metadata"]["test_name"]),
)
if errors:
for error in errors:
printer.print_data_test_error(
error["model"],
error["explore"],
error["metadata"]["test_name"],
error["message"],
error["metadata"]["lookml_url"],
)
logger.info("")
raise GenericValidationError