Skip to content

Commit

Permalink
increased coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
fopina committed Jan 14, 2016
1 parent 3eae528 commit 2becae7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def google(self, message, text):
reply = '%(titleNoFormatting)s\n\n%(content)s\n\n%(url)s' % res
except IndexError:
reply = 'Sorry, nothing found...'
else:
else: # pragma: no cover
reply = 'It seems I\'m googling too much lately, I need to rest a little...'

self.bot.send_message(message.chat.id, reply, reply_to_message_id=message.message_id, disable_web_page_preview=True)
9 changes: 9 additions & 0 deletions tests/test_guess.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ def test_play(self):

self.receive_message('5')
self.assertReplied(self.bot, 'Congratz, you nailed it John')

def test_stop(self):
self.receive_message('/guess_start')
self.assertReplied(self.bot, "I'm going to think of a number between 0 and 9 and you have to guess it! What's your guess?")
self.assertIsNotNone(self.plugin.read_data(1))

self.receive_message('/guess_stop')
self.assertReplied(self.bot, 'Ok :(')
self.assertIsNone(self.plugin.read_data(1))
6 changes: 6 additions & 0 deletions tests/test_simsimi.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,9 @@ def test_reply(self):

# any reply will do...
self.last_reply(self.bot)

def test_no_reply(self):
self.receive_message('')

# any reply will do...
self.assertRaisesRegexp(AssertionError, 'No replies', self.last_reply, self.bot)

0 comments on commit 2becae7

Please sign in to comment.