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