Coverage for tests/test_update_files.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-07-28 16:50 +0200

1import unittest 

2 

3from archive_md_urls import update_files 

4from tests.testfiles import CONVERTED_SOURCE, TEST_MD1_SOURCE 

5 

6# Create correct URL-Snapshot pairs for TEST_MD1 file 

7WAYBACK_URLS: dict[str, str] = { 

8 "example.com": 

9 "http://web.archive.org/web/20140428170257/http://www.example.com/", 

10 "github.com": 

11 "http://web.archive.org/web/20140430012615/https://github.com", 

12 "https://github.com/pypa/pip": 

13 "http://web.archive.org/web/20130829090428/https://github.com/pypa/pip" 

14} 

15 

16 

17class TestUpdateFiles(unittest.TestCase): 

18 """Test if files are updated correctly.""" 

19 

20 def test_update_source(self) -> None: 

21 """Test of Markdown source is correctly updated.""" 

22 self.assertEqual( 

23 update_files.update_md_source(TEST_MD1_SOURCE, WAYBACK_URLS), 

24 # The CONVERTED_SOURCE file is identical to TEST_MD1_SOURCE but with 

25 # correctly updated URLs 

26 CONVERTED_SOURCE 

27 )