def it_uses_validate_path(tmpdir): patcher = patch('readthedocs.config.validation.validate_path') with patcher as validate_path: path = text_type(tmpdir.mkdir('a directory')) validate_path.return_value = path validate_directory(path, str(tmpdir)) validate_path.assert_called_with(path, str(tmpdir))
def it_rejects_files(tmpdir): tmpdir.join('file').write('content') with raises(ValidationError) as excinfo: validate_directory('file', str(tmpdir)) assert excinfo.value.code == INVALID_DIRECTORY