Skip to content
This repository was archived by the owner on Oct 21, 2024. It is now read-only.

HOTFIX: Use attribute versus instance #244

Merged
merged 2 commits into from
Apr 14, 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
14 changes: 4 additions & 10 deletions busy_beaver/apps/retweeter/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,8 @@
@twitter_bp.cli.command("poll_twitter", help="Find new tweets to post to Slack")
def poll_twitter(channel_name: str, workspace: str):
# TODO add logging and times
slack_installation = SlackInstallation.query.filter_by(
workspace_id=workspace
).first()
fetch_tweets_post_to_slack(
slack_installation.id, channel_name, username=TWITTER_USERNAME
)
installation = SlackInstallation.query.filter_by(workspace_id=workspace).first()
fetch_tweets_post_to_slack(installation.id, channel_name, username=TWITTER_USERNAME)


def start_post_tweets_to_slack_task(task_owner: ApiUser, channel_name):
Expand All @@ -37,11 +33,9 @@ def start_post_tweets_to_slack_task(task_owner: ApiUser, channel_name):
logger.info("[Busy Beaver] Kick off retweeter task")

twitter_handle = TWITTER_USERNAME
installation_id = SlackInstallation.query.filter_by(
workspace_id="T093FC1RC"
).first()
installation = SlackInstallation.query.filter_by(workspace_id="T093FC1RC").first()
job = fetch_tweets_post_to_slack.queue(
installation_id, channel_name, twitter_handle
installation.id, channel_name, twitter_handle
)

task = PostTweetTask(
Expand Down
1 change: 1 addition & 0 deletions tests/apps/poller/api/retweeter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def test_poll_twitter_smoke_test(
caplog, client, session, factory, patched_background_task
):
# Arrange
factory.SlackInstallation(workspace_id="T093FC1RC")
factory.ApiUser(username="test_user", token="abcd", role="admin")

# Act
Expand Down
3 changes: 2 additions & 1 deletion tests/apps/poller/api/update_events_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ def patched_background_task(patcher, create_fake_background_task):


@pytest.mark.integration
def test_poll_twitter_smoke_test(
def test_poll_sync_event_database_smoke_test(
caplog, client, session, factory, patched_background_task
):
# Arrange
factory.SlackInstallation(workspace_id="T093FC1RC")
factory.ApiUser(username="test_user", token="abcd", role="admin")

# Act
Expand Down
1 change: 1 addition & 0 deletions tests/apps/retweeter/task_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def patched_background_task(patcher, create_fake_background_task):
def test_start_post_tweet_task(session, factory, patched_background_task):
"""Test trigger function"""
# Arrange
factory.SlackInstallation(workspace_id="T093FC1RC")
api_user = factory.ApiUser(username="admin")
channel_name = "test-channel"

Expand Down