Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
pip install flake8 pytest -e .
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
Expand Down
4 changes: 4 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
"requests_oauthlib==2.0.0",
"ipdb",
"ipython",
"coverage",
"pytest",
"pytest-asyncio",
"pytz",
],
classifiers=[
"Development Status :: 3 - Alpha",
Expand Down
Empty file added tests/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions tests/test_tweet_bot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import time
from pathlib import Path
from unittest.mock import patch, MagicMock

from taogod_terminal.tweet_bot import parse_args, TWEET_FREQ


def test_parse_args():
with patch("argparse.ArgumentParser.parse_args", return_value=MagicMock(tweets=Path("tweets.json"))):
args = parse_args()
assert args.tweets == Path("tweets.json")

def test_tweet_frequency_logic():
last_post_time = time.time() - TWEET_FREQ.total_seconds() - 1
assert time.time() - last_post_time > TWEET_FREQ.total_seconds()
Loading