Ejemplo n.º 1
0
 def test_change_vote_to_skip(self):
     receivers.set_current_skip({
         "number": 1,
         "noskip": set(["fred"]),
         "skip": set(),
     })
     r = receivers.requested_skip(None, content="skip", user="******")
     self.assertEqual(r['content'], "fred voted to skip! 2 more votes required")
Ejemplo n.º 2
0
 def test_actually_skip(self):
     receivers.set_current_skip({
         "number": 1,
         "skip": set(["fred", "tommy", "dave", "sarah"]),
         "noskip": set(),
     })
     with mock.patch("random.choice") as choice:
         choice.side_effect = lambda x: x[0]
         with mock.patch("pubbot.squeezecenter.receivers.command") as command:
             r = receivers.requested_skip(None, content="skip", user="******")
             command.assert_called_with("playlist index +1")
     self.assertEqual(r['content'], "Good riddance.")
Ejemplo n.º 3
0
 def test_create_skip(self):
     with mock.patch("eventlet.spawn"):
         receivers.requested_skip(None, content="skip", user="******")
Ejemplo n.º 4
0
 def test_skip_zero(self):
     r = receivers.requested_skip(None, content="skip 0", user="******")
     self.assertEqual(r['content'], "Don't be daft")
Ejemplo n.º 5
0
 def test_skip_in_progress(self):
     receivers.set_current_skip({})
     r = receivers.requested_skip(None, content="skip 20", user="******")
     self.assertEqual(r['content'], "Vote already in progress; can't start another")