~ubuntu-branches/ubuntu/utopic/gozerbot/utopic

« back to all changes in this revision

Viewing changes to plugtests/test_choice.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeremy Malcolm
  • Date: 2009-09-14 09:00:29 UTC
  • mfrom: (1.1.4 upstream) (3.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20090914090029-uval0ekt72kmklxw
Tags: 0.9.1.3-3
Changed dependency on python-setuptools to python-pkg-resources
(Closes: #546435) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# tests/test_choice.py
2
 
#
3
 
#
4
 
 
5
 
__copyright__ = 'this file is in the public domain'
6
 
 
7
 
from gozerbot.bot import Bot
8
 
from gozerbot.generic import stringinlist, waitforqueue
9
 
from gozerbot.plugins import plugins
10
 
import unittest, Queue
11
 
 
12
 
plugins.reload('gozerplugs.plugs', 'choice')
13
 
 
14
 
class test_choice(unittest.TestCase):
15
 
    b = Bot()
16
 
    b.userhosts['test'] = 'test@test'
17
 
 
18
 
    def test_choice(self):
19
 
        result = self.b.test('choice')
20
 
        self.assert_(stringinlist('space seperated list', result))
21
 
 
22
 
    def test_choice2(self):
23
 
        result = self.b.test('choice a b')
24
 
        self.assert_('a' in result[0] or 'b' in result[0])
25
 
 
26
 
    def test_choice3(self):
27
 
        q = Queue.Queue()
28
 
        q.put('a')
29
 
        q.put('b')
30
 
        q.put(None)
31
 
        result = self.b.test('choice', kw = {'inqueue': q })
32
 
        self.assert_('a' in result[0] or 'b' in result[0])