Ejemplo n.º 1
0
    def test_display_with_items(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('display', 'todo', None)
        queue.queue(self.phenny, self.input)
        self.expect_msg('[tester:todo] - lorem, ipsum')
Ejemplo n.º 2
0
    def test_display_empty(self):
        self.set_input('new', 'todo', None)
        queue.queue(self.phenny, self.input)

        self.set_input('display', 'todo', None)
        queue.queue(self.phenny, self.input)
        self.expect_msg('[tester:todo] - <empty>')
Ejemplo n.º 3
0
    def test_display_with_items(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('display', 'todo', None)
        queue.queue(self.phenny, self.input)
        self.expect_msg('[tester:todo] - lorem, ipsum')
Ejemplo n.º 4
0
    def test_display_empty(self):
        self.set_input('new', 'todo', None)
        queue.queue(self.phenny, self.input)

        self.set_input('display', 'todo', None)
        queue.queue(self.phenny, self.input)
        self.expect_msg('[tester:todo] - <empty>')
Ejemplo n.º 5
0
    def test_random_item(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'random', None)
        queue.queue(self.phenny, self.input)
        messages = ("'%s' is the lucky one." % x for x in ['dolor', 'sit', 'amet'])
        self.assertIn(self.phenny.reply.call_args[0][0], messages)
Ejemplo n.º 6
0
    def test_random_item(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'random', None)
        queue.queue(self.phenny, self.input)
        messages = ("'%s' is the lucky one." % x
                    for x in ['dolor', 'sit', 'amet'])
        self.assertIn(self.phenny.reply.call_args[0][0], messages)
Ejemplo n.º 7
0
    def test_delete_queue(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)
        self.set_input('delete', 'todo', None)
        queue.queue(self.phenny, self.input)

        self.phenny.reply.reset_mock()

        self.set_input('display', 'todo', None)
        queue.queue(self.phenny, self.input)
        self.expect_reply('No queues found.')
Ejemplo n.º 8
0
    def test_delete_queue(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)
        self.set_input('delete', 'todo', None)
        queue.queue(self.phenny, self.input)

        self.phenny.reply.reset_mock()

        self.set_input('display', 'todo', None)
        queue.queue(self.phenny, self.input)
        self.expect_reply('No queues found.')
Ejemplo n.º 9
0
    def _test_mutating(self, output, revert=True):
        input = self.input.group

        self.set_input('todo', 'reassign', 'devil')
        queue.queue(self.phenny, self.input)

        self.phenny.msg.reset_mock()
        self.phenny.reply.reset_mock()

        self.input.group = input
        queue.queue(self.phenny, self.input)
        self.expect_reply('You aren\'t the owner of this queue!')

        self.input.admin = True

        if revert:
            self.set_input('todo', 'reassign', self.input.nick)
            queue.queue(self.phenny, self.input)
            self.phenny.msg.reset_mock()

        self.input.group = input
        queue.queue(self.phenny, self.input)
        self.expect_msg(output)
Ejemplo n.º 10
0
    def _test_mutating(self, output, revert=True):
        input = self.input.group

        self.set_input('todo', 'reassign', 'devil')
        queue.queue(self.phenny, self.input)

        self.phenny.msg.reset_mock()
        self.phenny.reply.reset_mock()

        self.input.group = input
        queue.queue(self.phenny, self.input)
        self.expect_reply('You aren\'t the owner of this queue!')

        self.input.admin = True

        if revert:
            self.set_input('todo', 'reassign', self.input.nick)
            queue.queue(self.phenny, self.input)
            self.phenny.msg.reset_mock()

        self.input.group = input
        queue.queue(self.phenny, self.input)
        self.expect_msg(output)
Ejemplo n.º 11
0
    def test_pop_item(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'pop', None)
        self._test_mutating('[tester:todo] - ipsum')
Ejemplo n.º 12
0
    def test_replace_index(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'replace', '1, dolor')
        self._test_mutating('[tester:todo] - lorem, dolor')
Ejemplo n.º 13
0
    def test_replace_index(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'replace', '1, dolor')
        self._test_mutating('[tester:todo] - lorem, dolor')
Ejemplo n.º 14
0
    def test_swap_items(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'swap', 'lorem, ipsum')
        self._test_mutating('[tester:todo] - ipsum, lorem')
Ejemplo n.º 15
0
    def test_reassign_queue(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'reassign', 'devil')
        self._test_mutating('[devil:todo] - lorem, ipsum')
Ejemplo n.º 16
0
    def test_rename_queue(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'rename', 'nope')
        self._test_mutating('[devil:nope] - dolor, sit, amet', revert=False)
Ejemplo n.º 17
0
    def test_reassign_queue(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'reassign', 'devil')
        self._test_mutating('[devil:todo] - lorem, ipsum')
Ejemplo n.º 18
0
 def test_create_with_items(self):
     self.set_input('new', 'todo', 'lorem, ipsum')
     queue.queue(self.phenny, self.input)
     self.expect_reply('Queue tester:todo with items lorem, ipsum created.')
Ejemplo n.º 19
0
 def test_create_empty(self):
     self.set_input('new', 'todo', None)
     queue.queue(self.phenny, self.input)
     self.expect_reply('Empty queue tester:todo created.')
Ejemplo n.º 20
0
 def test_display_not_found(self):
     self.set_input('display', 'todo', None)
     queue.queue(self.phenny, self.input)
     self.expect_reply('No queues found.')
Ejemplo n.º 21
0
    def test_rename_queue(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'rename', 'nope')
        self._test_mutating('[devil:nope] - dolor, sit, amet', revert=False)
Ejemplo n.º 22
0
 def test_display_not_found(self):
     self.set_input('display', 'todo', None)
     queue.queue(self.phenny, self.input)
     self.expect_reply('No queues found.')
Ejemplo n.º 23
0
 def test_create_with_items(self):
     self.set_input('new', 'todo', 'lorem, ipsum')
     queue.queue(self.phenny, self.input)
     self.expect_reply('Queue tester:todo with items lorem, ipsum created.')
Ejemplo n.º 24
0
    def test_pop_item(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'pop', None)
        self._test_mutating('[tester:todo] - ipsum')
Ejemplo n.º 25
0
 def test_create_empty(self):
     self.set_input('new', 'todo', None)
     queue.queue(self.phenny, self.input)
     self.expect_reply('Empty queue tester:todo created.')
Ejemplo n.º 26
0
    def test_add_items(self):
        self.set_input('new', 'todo', None)
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'add', 'dolor, sit, amet')
        self._test_mutating('[tester:todo] - dolor, sit, amet')
Ejemplo n.º 27
0
    def test_swap_items(self):
        self.set_input('new', 'todo', 'lorem, ipsum')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'swap', 'lorem, ipsum')
        self._test_mutating('[tester:todo] - ipsum, lorem')
Ejemplo n.º 28
0
    def test_move_items(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'move', 'dolor, amet')
        self._test_mutating('[tester:todo] - sit, amet, dolor')
Ejemplo n.º 29
0
    def test_add_items(self):
        self.set_input('new', 'todo', None)
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'add', 'dolor, sit, amet')
        self._test_mutating('[tester:todo] - dolor, sit, amet')
Ejemplo n.º 30
0
    def test_replace_items(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'replace', 'amet, meta')
        self._test_mutating('[tester:todo] - dolor, sit, meta')
Ejemplo n.º 31
0
    def test_move_items(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'move', 'dolor, amet')
        self._test_mutating('[tester:todo] - sit, amet, dolor')
Ejemplo n.º 32
0
    def test_replace_items(self):
        self.set_input('new', 'todo', 'dolor, sit, amet')
        queue.queue(self.phenny, self.input)

        self.set_input('todo', 'replace', 'amet, meta')
        self._test_mutating('[tester:todo] - dolor, sit, meta')