def test_relativePathForMarkdownUrl_non_exist(): '''gets relative path for a file that doesn't exist should return None''' #arrange/act relPath = relativePathForMarkdownUrl('NON_EXIST.png', 'tests/TEST.md') #assert assert relPath == None
def test_relativePathForMarkdownUrl(): '''gets relative path for simple file''' #arrange/act relPath = relativePathForMarkdownUrl('TEST_IMAGE.png', 'tests/TEST.md') #assert assert relPath == Path('tests/TEST_IMAGE.png')
def test_relativePathForMarkdownUrl_file_url(): '''gets relative path for a url beginning with file://''' #arrange/act relPath = relativePathForMarkdownUrl('file://TEST%20IMAGE%20HAS%20SPACES.png', 'tests/TEST.md') #assert assert relPath == Path('tests/TEST IMAGE HAS SPACES.png')
def test_relativePathForMarkdownUrl_encoded(): '''gets relative path for a path that has encoding (which is kind of wonky by we'll support it)''' #arrange/act relPath = relativePathForMarkdownUrl('TEST%20IMAGE%20HAS%20SPACES.png', 'tests/TEST.md') #assert assert relPath == Path('tests/TEST IMAGE HAS SPACES.png')
def test_relativePathForMarkdownUrl_http_url(): '''gets relative path for simple file''' #arrange/act relPath = relativePathForMarkdownUrl('http://cobertos.com/non_exist.png', 'tests/TEST.md') #assert assert relPath == None