Пример #1
0
def test_rst_checker_check_current_version(patches, errors):
    checker = rst_check.RSTChecker("path1", "path2", "path3")

    patched = patches(
        "CurrentVersionFile",
        "RSTChecker.error",
        prefix="tools.docs.rst_check")

    with patched as (m_version, m_error):
        m_version.return_value.run_checks.return_value = errors
        checker.check_current_version()

    assert (
        list(m_version.call_args)
        == [('docs/root/version_history/current.rst',), {}])
    assert (
        list(m_version.return_value.run_checks.call_args)
        == [(), {}])

    if not errors:
        assert not m_error.called
    else:
        assert (
            list(m_error.call_args)
            == [('current_version', ['err1', 'err2']), {}])
Пример #2
0
def test_rst_checker_constructor():
    checker = rst_check.RSTChecker("path1", "path2", "path3")
    assert checker.checks == ("current_version", )
    assert checker.args.paths == ['path1', 'path2', 'path3']