-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
101 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,7 @@ | |
*.db | ||
config.yaml | ||
diffs/* | ||
.cache | ||
.eggs | ||
test | ||
diffengine.egg-info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
python: | ||
- '3.5' | ||
|
||
language: python | ||
|
||
install: | ||
- python setup.py install | ||
|
||
script: | ||
- python setup.py test | ||
|
||
after_failure: | ||
- cat test/diffengine.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ bleach | |
genshi | ||
jinja2 | ||
peewee | ||
pillow | ||
pyyaml | ||
tweepy | ||
requests | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[aliases] | ||
test=pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from setuptools import setup | ||
|
||
requirements = open("requirements.txt").read().split() | ||
|
||
setup( | ||
name="diffengine", | ||
version="0.0.1", | ||
author="Ed Summers", | ||
author_email="[email protected]", | ||
py_modules=["diffengine"], | ||
scripts=["bin/diffengine"], | ||
description="Tweet changes to stories in RSS feeds", | ||
requirements=requirements, | ||
setup_requires=["pytest-runner"], | ||
tests_require=["pytest"] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import os | ||
import PIL | ||
import pytest | ||
import shutil | ||
|
||
from diffengine import * | ||
|
||
if os.path.isdir("test"): | ||
shutil.rmtree("test") | ||
|
||
init("test") | ||
|
||
# the sequence of these tests is significant | ||
|
||
def test_feed(): | ||
f = Feed.create(name="Test", url="https://inkdroid.org/feed.xml") | ||
f.get_latest() | ||
assert f.created | ||
assert len(f.entries) == 10 | ||
|
||
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 | ||
|
||
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(force=True) | ||
assert type(v2) == EntryVersion | ||
assert v2.next_diff | ||
|
||
diff = v2.next_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) |