How to use the spectacles.cli.main function in spectacles

To help you get started, we’ve selected a few spectacles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_help():
    with pytest.raises(SystemExit) as cm:
        main()
        assert cm.value.code == 0
github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_main_with_sql_validator(mock_tracking, mock_runner, env, caplog):
    validation = build_validation("sql")
    mock_runner.return_value.validate_sql.return_value = validation
    with pytest.raises(SystemExit):
        main()
    mock_tracking.track_invocation_start.assert_called_once_with(
        "BASE_URL_ENV_VAR", "sql", project="PROJECT_ENV_VAR"
    )
    # TODO: Uncomment the below assertion once #262 is fixed
    # mock_tracking.track_invocation_end.assert_called_once()
    mock_runner.assert_called_once_with(
        "BASE_URL_ENV_VAR",  # base_url
        "PROJECT_ENV_VAR",  # project
        "BRANCH_ENV_VAR",  # branch
        "CLIENT_ID_ENV_VAR",  # client_id
        "CLIENT_SECRET_ENV_VAR",  # client_secret
        8080,  # port
        3.1,  # api_version
        False,  # remote_reset
        False,  # import_projects
        None,  # commit_ref
github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_main_with_do_not_track(mock_tracking, mock_run_connect, env):
    main()
    mock_tracking.track_invocation_start.assert_not_called()
    mock_tracking.track_invocation_end.assert_not_called()
    mock_run_connect.assert_called_once_with(
        "BASE_URL_ENV_VAR",  # base_url
        "CLIENT_ID_ENV_VAR",  # client_id
        "CLIENT_SECRET_ENV_VAR",  # client_secret
        8080,  # port
        3.1,  # api_version
    )
github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_help(parser,):
    with pytest.raises(SystemExit) as cm:
        main()
        assert cm.value.code == 0
github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_main_with_connect(mock_tracking, mock_run_connect, env):
    main()
    mock_tracking.track_invocation_start.assert_called_once_with(
        "BASE_URL_ENV_VAR", "connect", project=None
    )
    mock_tracking.track_invocation_end.assert_called_once()
    mock_run_connect.assert_called_once_with(
        "BASE_URL_ENV_VAR",  # base_url
        "CLIENT_ID_ENV_VAR",  # client_id
        "CLIENT_SECRET_ENV_VAR",  # client_secret
        8080,  # port
        3.1,  # api_version
    )
github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_main_with_content_validator(mock_tracking, mock_runner, env, caplog):
    validation = build_validation("content")
    mock_runner.return_value.validate_content.return_value = validation
    with pytest.raises(SystemExit):
        main()
    mock_tracking.track_invocation_start.assert_called_once_with(
        "BASE_URL_ENV_VAR", "content", project="PROJECT_ENV_VAR"
    )
    # TODO: Uncomment the below assertion once #262 is fixed
    # mock_tracking.track_invocation_end.assert_called_once()
    mock_runner.assert_called_once_with(
        "BASE_URL_ENV_VAR",  # base_url
        "PROJECT_ENV_VAR",  # project
        "BRANCH_ENV_VAR",  # branch
        "CLIENT_ID_ENV_VAR",  # client_id
        "CLIENT_SECRET_ENV_VAR",  # client_secret
        8080,  # port
        3.1,  # api_version
        False,  # remote_reset
        False,  # import_projects
        None,  # commit_ref
github spectacles-ci / spectacles / tests / test_cli.py View on Github external
def test_main_with_assert_validator(mock_tracking, mock_runner, env, caplog):
    validation = build_validation("assert")
    mock_runner.return_value.validate_data_tests.return_value = validation
    with pytest.raises(SystemExit):
        main()
    mock_tracking.track_invocation_start.assert_called_once_with(
        "BASE_URL_ENV_VAR", "assert", project="PROJECT_ENV_VAR"
    )
    # TODO: Uncomment the below assertion once #262 is fixed
    # mock_tracking.track_invocation_end.assert_called_once()
    mock_runner.assert_called_once_with(
        "BASE_URL_ENV_VAR",  # base_url
        "PROJECT_ENV_VAR",  # project
        "BRANCH_ENV_VAR",  # branch
        "CLIENT_ID_ENV_VAR",  # client_id
        "CLIENT_SECRET_ENV_VAR",  # client_secret
        8080,  # port
        3.1,  # api_version
        False,  # remote_reset
        False,  # import_projects
        None,  # commit_ref