Example #1
0
def test_ScanOverrides_parse_upload_settings_overrides_cli_passed_settings_success(
        get_endpoint_mock, parse_webinspect_mock, run_env_mock, isfile_mock):
    # Given
    isfile_mock.return_value = False
    overrides = _setup_overrides(expected_settings="NotDefault")
    scan_overrides_object = ScanOverrides(overrides)

    # When
    scan_overrides_object._parse_upload_settings_overrides()

    # Expect
    assert scan_overrides_object.webinspect_upload_settings in '/path/to/git/settings/NotDefault.xml'
Example #2
0
def test_ScanOverrides_parse_upload_settings_overrides_success(
        get_endpoint_mock, parse_webinspect_mock, run_env_mock, isfile_mock):
    # Given
    isfile_mock.return_value = False

    overrides = _setup_overrides()
    scan_overrides_object = ScanOverrides(overrides)

    # When
    scan_overrides_object._parse_upload_settings_overrides()

    # Expect
    assert scan_overrides_object.webinspect_upload_settings is None
Example #3
0
def test_ScanOverrides_parse_upload_settings_cli_passed_upload_settings_success(
        get_endpoint_mock, parse_webinspect_mock, run_env_mock, isfile_mock):
    # Given
    overrides = _setup_overrides(
        expected_upload_settings="/valid/path/NotDefault.xml")
    scan_overrides_object = ScanOverrides(overrides)
    # os.path.isfile is tricky have to mock it this way or there are odd side effects
    isfile_mock.side_effect = [False, True]

    # When
    scan_overrides_object._parse_upload_settings_overrides()

    # Expect
    assert scan_overrides_object.webinspect_upload_settings == "/valid/path/NotDefault.xml"