Skip to content

Commit

Permalink
Complete testing for reply method
Browse files Browse the repository at this point in the history
  • Loading branch information
chillipeper committed May 3, 2019
1 parent ae0955e commit f3cdc8d
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion will/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def topic_event(plugin, event, content, outgoing_topic, source_message):
})


def test__init__(plugin):
def test__init__():
kwargs = {"bot": "test"}
plugin = WillPlugin(**kwargs)
assert plugin.bot == "test"
Expand Down Expand Up @@ -182,6 +182,33 @@ def test_reply_package_for_scheduling_is_false(plugin, content, event,
plugin.publish.assert_called_once_with(outgoing_topic, reply_event)


@freeze_time(WILLS_BIRTHDAY)
def test_reply_event_has_words_and_no_content(plugin, content, event, reply_event,
source_message, outgoing_topic):
incoming_event = event({"data": source_message})
plugin.message = incoming_event
plugin.reply(event=content)
plugin.publish.assert_called_once_with(outgoing_topic, reply_event)


@freeze_time(WILLS_BIRTHDAY)
def test_reply_event_and_content_passed_backwards(plugin, reply_event, content,
event, source_message,
outgoing_topic):
incoming_event = event({"data": source_message})
plugin.reply(event=content, content=incoming_event)
plugin.publish.assert_called_once_with(outgoing_topic, reply_event)


@freeze_time(WILLS_BIRTHDAY)
def test_reply_message_has_data(plugin, content, event, reply_event,
source_message, outgoing_topic):
incoming_event = event({"data": source_message})
plugin.message = incoming_event
plugin.reply(event=content, content=content)
plugin.publish.assert_called_once_with(outgoing_topic, reply_event)


def test_reply_channel_in_kwargs(plugin, event, content, source_message):
incoming_event = event({"data": source_message})
reply = plugin.reply(incoming_event, content, channel="test")
Expand Down

0 comments on commit f3cdc8d

Please sign in to comment.