Skip to content

Commit

Permalink
Add docstrings to fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
chillipeper committed May 3, 2019
1 parent 4a00d9e commit e529d56
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions will/tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

@pytest.fixture
def plugin(mocker):
"""Initialize plugin module and mock methods"""
mocker.patch.object(WillPlugin, "publish", return_value=None)
mocker.patch.object(WillPlugin, "add_outgoing_event_to_schedule",
return_value=None)
Expand All @@ -19,23 +20,27 @@ def plugin(mocker):

@pytest.fixture
def content():
"""Response to be shown on the io_backend"""
return "This is a test content"


@pytest.fixture
def source_message(message, io_backend):
"""Message comming from an io_backend"""
return message({"backend": io_backend})


@pytest.fixture
def outgoing_topic(plugin, source_message):
"""Topic with which an event is published"""
backend = plugin.get_backend(source_message, None)
return "message.outgoing.{}".format(backend)


@pytest.fixture
@freeze_time(WILLS_BIRTHDAY)
def say_event(event, content, source_message):
"""Mimics an event abstraction for say method"""
return event({
'type': "say",
'content': content,
Expand All @@ -47,6 +52,7 @@ def say_event(event, content, source_message):
@pytest.fixture
@freeze_time(WILLS_BIRTHDAY)
def reply_event(plugin, event, content, source_message, outgoing_topic):
"""Mimics an event abstraction for reply method"""

return event({
'type': "reply",
Expand All @@ -60,6 +66,7 @@ def reply_event(plugin, event, content, source_message, outgoing_topic):
@pytest.fixture
@freeze_time(WILLS_BIRTHDAY)
def topic_event(plugin, event, content, outgoing_topic, source_message):
"""Mimics an event abstraction for set_topic method"""

return event({
'type': "topic_change",
Expand Down

0 comments on commit e529d56

Please sign in to comment.