Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Improve tests
Browse files Browse the repository at this point in the history
  • Loading branch information
HairyFotr committed Feb 21, 2016
1 parent fe3a53c commit 71a50e7
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def test_basic_action(self, request):
request.return_value = resp

for action in ['@mygroup', '@group', '@leaveall']:
assert self._say_response('#psywerx', 'smotko', '@mygroup', resp)
assert self._say_response('#psywerx', 'smotko', action, resp)


class PsywerxKarmaPluginTestCase(BasePluginTestCase):
Expand All @@ -130,6 +130,27 @@ def test_nick_karma(self, request):
self._say_response('#psywerx', 'smotko', '@karma test1',
'test1 has ' + resp + ' karma.')

@patch("plugins.psywerx_karma.PsywerxKarma.request")
def test_karma_server_fail(self, request):
request.return_value = None

self._say_response('#psywerx', 'smotko', '@karma',
'Sorry, could not get karmas.')
self._say_response('#psywerx', 'smotko', '@karma test1',
'Sorry, could not get karma for test1.')

@patch("plugins.psywerx_karma.PsywerxKarma.request")
def test_give_karma(self, request):
request.return_value = '_return value ignored_'

self._say_no_response('#psywerx', 'smotko', 'test1++')
self.assertTrue(self.plugin.request.called)

def test_give_self_karma(self):
self._say_response('#psywerx', 'smotko', 'smotko++',
'Nice try smotko, but you can\'t ' +
'give karma to yourself!')


class PsywerxHistoryPluginTestCase(BasePluginTestCase):
def setUp(self):
Expand Down

0 comments on commit 71a50e7

Please sign in to comment.