def test_validate_notexisting():
    """
    Unexisting path should be invalid and return an error message.
    """
    exporter = JinjaExport(template_dir="/home/wrong")

    msg = "Given template directory does not exists: /home/wrong"

    assert exporter.validate() == msg
def test_validate_success():
    """
    Existing path should be valid and does not return any message.

    We just use the default path that should always be valid.
    """
    exporter = JinjaExport()

    assert exporter.validate() == False
def test_validate_missing_files(settings):
    """
    Directory which misses some required templates should be invalid and return
    an error message.

    Use an existing directory from application but which is not a template
    directory.
    """
    exporter = JinjaExport(template_dir=settings.tests_dir)

    msg = ("Some required files are missing from template directory: "
           "audit.html, report.html, main.css, summary.html")

    assert exporter.validate() == msg