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_log_SQL(self):
with self.assertLogs(logger=logger, level="INFO") as cm:
func = MagicMock()
func.__name__ = "run_sql"
decorated_func = utils.log_duration(func)
decorated_func()
self.assertIn("INFO:spectacles:Completed SQL validation in", cm.output[0])
def test_log_assert(self):
with self.assertLogs(logger=logger, level="INFO") as cm:
func = MagicMock()
func.__name__ = "run_assert"
decorated_func = utils.log_duration(func)
decorated_func()
self.assertIn("INFO:spectacles:Completed data test validation in", cm.output[0])
def test_log_content(self):
with self.assertLogs(logger=logger, level="INFO") as cm:
func = MagicMock()
func.__name__ = "run_content"
decorated_func = utils.log_duration(func)
decorated_func()
self.assertIn("INFO:spectacles:Completed content validation in", cm.output[0])
def test_log_other(self):
with self.assertLogs(logger=logger, level="INFO") as cm:
func = MagicMock()
func.__name__ = "OtherValidator.validate"
decorated_func = utils.log_duration(func)
decorated_func()
self.assertIn("INFO:spectacles:Completed validation in", cm.output[0])
@log_duration
def run_assert(
project,
branch,
explores,
exclude,
base_url,
client_id,
client_secret,
port,
api_version,
remote_reset,
import_projects,
commit_ref,
) -> None:
runner = Runner(
base_url,
@log_duration
def run_content(
project,
branch,
explores,
excludes,
base_url,
client_id,
client_secret,
port,
api_version,
remote_reset,
import_projects,
commit_ref,
incremental,
exclude_personal,
) -> None:
@log_duration
def validate_data_tests(self) -> Dict[str, Any]:
with self.branch_manager:
data_test_validator = DataTestValidator(self.client, self.project)
results = data_test_validator.validate()
return results
@log_duration
def validate_sql(
self,
selectors: List[str],
exclusions: List[str],
mode: str = "batch",
concurrency: int = 10,
) -> Dict[str, Any]:
with self.branch_manager:
sql_validator = SqlValidator(self.client, self.project, concurrency)
sql_validator.build_project(selectors, exclusions)
results = sql_validator.validate(mode)
return results
@log_duration
def run_sql(
log_dir,
project,
branch,
explores,
exclude,
base_url,
client_id,
client_secret,
port,
api_version,
mode,
remote_reset,
import_projects,
concurrency,
commit_ref,