Exemplo n.º 1
0
def test_diff():
    f = Feed.get(Feed.url == "https://inkdroid.org/feed.xml")
    e = f.entries[0]
    v1 = e.versions[0]

    # remove some characters from the version
    v1.summary = v1.summary[0:-20]
    v1.save()

    v2 = e.get_latest()
    assert type(v2) == EntryVersion
    assert v2.diff
    assert v2.archive_url is not None
    assert (re.match("^https://web.archive.org/web/[0-9]+/.+$", v2.archive_url)
            is not None)

    diff = v2.diff
    assert diff.old == v1
    assert diff.new == v2
    assert os.path.isfile(diff.html_path)
    assert os.path.isfile(diff.screenshot_path)
    assert os.path.isfile(diff.thumbnail_path)

    # check that the url for the internet archive diff is working
    assert re.match("^https://web.archive.org/web/diff/\d+/\d+/https.+$",
                    diff.url)
Exemplo n.º 2
0
def test_whitespace():
    f = Feed.get(url="https://inkdroid.org/feed.xml")
    e = f.entries[0]
    v1 = e.versions[-1]

    # add some whitespace
    v1.summary = v1.summary + "\n\n    "
    v1.save()

    # whitespace should not count when diffing
    v2 = e.get_latest()
    assert v2 == None
Exemplo n.º 3
0
def test_html_diff():
    f = Feed.get(Feed.url == "https://inkdroid.org/feed.xml")
    e = f.entries[0]

    # add a change to the summary that htmldiff ignores
    v1 = e.versions[-1]
    parts = v1.summary.split()
    parts.insert(2, "<br>   \n")
    v1.summary = " ".join(parts)
    v1.save()

    v2 = e.get_latest()
    assert v2 is None
Exemplo n.º 4
0
def test_entry():
    f = Feed.get(Feed.url == "https://inkdroid.org/feed.xml")
    e = f.entries[0]
    v = e.get_latest()
    assert type(v) == EntryVersion
    assert len(e.versions) == 1