def test_msg(self): base.create_response('http://downforeveryoneorjustme.com/blah.com', '') self._proto.privmsg('tester', base.TEST_CHANNEL, '!isitdown http://blah.com') self.assertEqual(1, len(self._proto.msgs)) self.assertEqual( self._proto.msgs[0][2], 'blah.com is up')
def test_query(self): base.create_response('http://downforeveryoneorjustme.com/blah', '') base.create_response('http://downforeveryoneorjustme.com/halb', 'not just you!') up = self._plugin.query('blah') self.assertTrue(up) up = self._plugin.query('halb') self.assertFalse(up)
def test_msg(self): base.create_response('http://developerexcuses.com', '<a>dog ate it</a>') self._proto.privmsg('tester', base.TEST_CHANNEL, '!excuse') self.assertEqual(1, len(self._proto.msgs)) self.assertEqual(self._proto.msgs[0][2], 'dog ate it')
def test_query(self): base.create_response('http://developerexcuses.com', '<a>dog ate it</a>') m = self._plugin.query_excuse() self.assertEqual(m, 'dog ate it')
def test_msg(self): base.create_response('http://itsthisforthat.com/.*', 'a test') self._proto.privmsg('tester', base.TEST_CHANNEL, '!startup') self.assertEqual(1, len(self._proto.msgs)) self.assertEqual(self._proto.msgs[0][2], 'A test')
def test_query(self): base.create_response('http://itsthisforthat.com/.*', 'a test') m = self._startup.query_startup() self.assertEqual(m, 'A test')
def test_multiple_link(self): base.create_response('http://test.com', '<body><title>blah</title></body>') self._proto.privmsg('tester', base.TEST_CHANNEL, 'http://test.com ' * 2) self.assertEqual(2, len(self._proto.msgs)) self.assertEqual(self._proto.msgs[0], ('msg', base.TEST_CHANNEL, 'Link: blah')) self.assertEqual(self._proto.msgs[1], ('msg', base.TEST_CHANNEL, 'Link: blah'))
def test_inside_link(self): base.create_response('http://test.com', '<body><title>blah</title></body>') self._proto.privmsg('tester', base.TEST_CHANNEL, 'check out http://test.com this link') self.assertEqual(1, len(self._proto.msgs)) self.assertEqual(self._proto.msgs[0], ('msg', base.TEST_CHANNEL, 'Link: blah'))
def test_title(self): base.create_response('http://test.com', '<body><title>blah</title></body>') m = self._linker.get_title('http://test.com') self.assertEqual(m, 'Link: blah')