Changeset - cf2d825a08db
[Not reviewed]
0 1 0
Brett Smith - 4 years ago 2020-08-30 13:18:41
brettcsmith@brettcsmith.org
tests: Reorganize extract_odf_links tests for new feature.
1 file changed with 15 insertions and 6 deletions:
0 comments (0 inline, 0 general)
tests/test_extract_odf_links.py
Show inline comments
...
 
@@ -20,2 +20,4 @@ import pytest
 

	
 
from pathlib import Path
 

	
 
from . import testutil
...
 
@@ -26,8 +28,14 @@ SRC_PATH = testutil.test_path('repository/LinksReport.ods')
 

	
 
EXPECTED_FILE_LINKS = {
 
    '/repository/Projects/project-data.yml',
 
    str(testutil.test_path('repository/Projects/project-data.yml')),
 
    str(testutil.test_path('repository/Projects/Bad Link.txt')),
 
INCLUDED_FILE_LINKS = {
 
    Path('/repository/Projects/project-data.yml'),
 
    Path('Projects/project-data.yml'),
 
    Path('Projects/Bad Link.txt'),
 
}
 

	
 
def expected_links(rel_path):
 
    return frozenset(
 
        str(path if path.is_absolute() else rel_path / path)
 
        for path in INCLUDED_FILE_LINKS
 
    )
 

	
 
@pytest.mark.parametrize('arglist,sep', [
...
 
@@ -47,4 +55,5 @@ def test_extract_file_links(arglist, sep, caplog):
 
        actual.pop()
 
    assert len(actual) == len(EXPECTED_FILE_LINKS)
 
    assert set(actual) == EXPECTED_FILE_LINKS
 
    expected = expected_links(SRC_PATH.parent)
 
    assert len(actual) == len(expected)
 
    assert set(actual) == expected
 
    assert caplog.records
0 comments (0 inline, 0 general)