示例#1
0
def test_urlParse():
    filePath = "tests/testFile.txt"
    testUrl = "https://gist.github.com/chrispinkney/069b09d2da5b9f7b73347d13ba3c32e7.js"
    fileUrl = []
    testFile = fileReader.TextFile(filePath)
    for url in testFile.fileUrls:
        fileUrl.append(url[0] + "://" + url[1] + url[2])
    assert fileUrl[0] == testUrl
示例#2
0
def processFileWithIgnore(file, pattern, option):
    colorama.init()
    urlFile = fileReader.TextFile(file)
    for link in urlFile.fileLinks:
        urlFile.compareLinks(link.linkUrl, pattern)
        if urlFile.match:
            urlFile.fileLinks.remove(link)
    processLinks(file, urlFile, option)
示例#3
0
def test_fileNotFound(capsys):
    fileReader.TextFile("doesntExist.txt")
    captured = capsys.readouterr()
    assert captured.out == "File was not found\n"
示例#4
0
def test_linkObject_URL():
    filePath = "tests/testFile.txt"
    testFile = fileReader.TextFile(filePath)
    testUrl = "https://gist.github.com/chrispinkney/069b09d2da5b9f7b73347d13ba3c32e7.js"
    assert testFile.fileLinks[0].linkUrl == testUrl
示例#5
0
def test_linkObject_created():
    filePath = "tests/testFile.txt"
    testFile = fileReader.TextFile(filePath)
    for link in testFile.fileLinks:
        assert isinstance(link, fileReader.Link)
示例#6
0
def processFile(file, option):
    colorama.init()
    urlFile = fileReader.TextFile(file)
    processLinks(file, urlFile, option)