Example #1
0
def test_all_short_options(asciidoctor_mock, build_dir, spec_file,
                           version_file, destination_dir, adoc_data):
    in_file = adoc_data / "simple_test.input.adoc"

    main([
        str(in_file),
        "-s",
        str(spec_file),
        "-v",
        str(version_file),
        "-D",
        str(destination_dir),
        "-B",
        str(build_dir),
        "-b",
        "html5",
        "-W",
        "--debug",
        "--log",
        "WARNING",
    ])

    output_file = destination_dir / "simple_test.input.html"
    processed_file = build_dir / "intermediate" / ".asciidoxy.simple_test.input.adoc"
    asciidoctor_mock.assert_called_once_with(destination_dir, output_file,
                                             processed_file, False, "html5",
                                             [])
    assert processed_file.is_file()
Example #2
0
def test_all_options(asciidoctor_mock, build_dir, spec_file, version_file,
                     destination_dir, adoc_data):
    in_file = adoc_data / "simple_test.input.adoc"

    main([
        str(in_file),
        "--spec-file",
        str(spec_file),
        "--version-file",
        str(version_file),
        "--destination-dir",
        str(destination_dir),
        "--build-dir",
        str(build_dir),
        "--backend",
        "html5",
        "--warnings-are-errors",
        "--debug",
        "--log",
        "WARNING",
    ])

    output_file = destination_dir / "simple_test.input.html"
    processed_file = build_dir / "intermediate" / ".asciidoxy.simple_test.input.adoc"
    asciidoctor_mock.assert_called_once_with(destination_dir, output_file,
                                             processed_file, False, "html5",
                                             [])
    assert processed_file.is_file()
Example #3
0
def test_help():
    with pytest.raises(SystemExit) as exc_info:
        main(["-h"])
    assert exc_info.value.code == 0

    with pytest.raises(SystemExit) as exc_info:
        main(["--help"])
    assert exc_info.value.code == 0
def test_no_reference_loaded(asciidoctor_mock, build_dir, destination_dir,
                             adoc_data, event_loop):
    in_file = adoc_data / "no_api_reference.input.adoc"

    main([
        str(in_file), "--destination-dir",
        str(destination_dir), "--build-dir",
        str(build_dir)
    ])

    output_file = destination_dir / "no_api_reference.input.html"
    processed_file = build_dir / "intermediate" / ".asciidoxy.no_api_reference.input.adoc"
    asciidoctor_mock.assert_called_once_with(destination_dir, output_file,
                                             processed_file, False, "html5",
                                             [], Path("images"))
    assert processed_file.is_file()
Example #5
0
def test_process_file(asciidoctor_mock, build_dir, spec_file, destination_dir,
                      adoc_data):
    in_file = adoc_data / "simple_test.input.adoc"

    main([
        str(in_file), "--spec-file",
        str(spec_file), "--destination-dir",
        str(destination_dir), "--build-dir",
        str(build_dir)
    ])

    output_file = destination_dir / "simple_test.input.html"
    processed_file = build_dir / "intermediate" / ".asciidoxy.simple_test.input.adoc"
    asciidoctor_mock.assert_called_once_with(destination_dir, output_file,
                                             processed_file, False, "html5",
                                             [])
    assert processed_file.is_file()
def test_forward_unknown_options(asciidoctor_mock, build_dir, spec_file,
                                 destination_dir, adoc_data, event_loop):
    in_file = adoc_data / "simple_test.input.adoc"

    main([
        str(in_file), "--spec-file",
        str(spec_file), "--destination-dir",
        str(destination_dir), "--build-dir",
        str(build_dir), "--verbose", "-a", "specialoption"
    ])

    output_file = destination_dir / "simple_test.input.html"
    processed_file = build_dir / "intermediate" / ".asciidoxy.simple_test.input.adoc"
    asciidoctor_mock.assert_called_once_with(
        destination_dir, output_file, processed_file, False, "html5",
        ["--verbose", "-a", "specialoption"], Path("images"))
    assert processed_file.is_file()
def test_process_file_backend_pdf(asciidoctor_mock, build_dir, spec_file,
                                  destination_dir, adoc_data, event_loop):
    in_file = adoc_data / "simple_test.input.adoc"

    main([
        str(in_file),
        "--spec-file",
        str(spec_file),
        "--destination-dir",
        str(destination_dir),
        "--build-dir",
        str(build_dir),
        "--backend",
        "pdf",
    ])

    output_file = destination_dir / "simple_test.input.pdf"
    processed_file = build_dir / "intermediate" / ".asciidoxy.simple_test.input.adoc"
    asciidoctor_mock.assert_called_once_with(destination_dir, output_file,
                                             processed_file, False, "pdf", [],
                                             Path("images"))
    assert processed_file.is_file()
Example #8
0
def test_no_arguments():
    with pytest.raises(SystemExit) as exc_info:
        main([])
    assert exc_info.value.code != 0