Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/tweetting fix #10

Merged
merged 6 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ script: py.test
before_install:
- sudo apt-get -y update
- sudo apt-get install firefox-geckodriver
- sudo apt-get install --upgrade chromium-chromedriver
before_script:
- wget https://chromedriver.storage.googleapis.com/83.0.4103.39/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip -d /home/travis/virtualenv/python3.7.1/bin/
- export CHROME_BIN=chromium-browser
after_failure: cat test/diffengine.log
notifications:
slack:
Expand Down
12 changes: 12 additions & 0 deletions diffengine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ class Diff(BaseModel):
emailed = DateTimeField(null=True)
blogged = DateTimeField(null=True)

@property
def url_changed(self):
return self.old.url != self.new.url

@property
def title_changed(self):
return self.old.title != self.new.title

@property
def summary_changed(self):
return self.old.summary != self.new.summary

@property
def html_path(self):
# use prime number to spread across directories
Expand Down
2 changes: 1 addition & 1 deletion diffengine/twitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def tweet_diff(self, diff, token=None, lang={}):

# Check if the thread exists
thread_status_id_str = None
if diff.old.entry.tweet_status_id_str is None:
if diff.old.entry.tweet_status_id_str == "":
try:
thread_status_id_str = self.create_thread(
diff.old.entry, diff.old, token
Expand Down
2 changes: 1 addition & 1 deletion test_diffengine.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def test_create_thread_if_old_entry_has_no_related_tweet(
):

entry = MagicMock()
type(entry).tweet_status_id_str = PropertyMock(return_value=None)
type(entry).tweet_status_id_str = PropertyMock(return_value="")

diff = get_mocked_diff()
type(diff.old).entry = entry
Expand Down