Esempio n. 1
0
    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')
Esempio n. 2
0
    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)
Esempio n. 3
0
    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')
Esempio n. 4
0
    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')
Esempio n. 5
0
    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')
Esempio n. 6
0
    def test_query(self):
        base.create_response('http://itsthisforthat.com/.*', 'a test')

        m = self._startup.query_startup()
        self.assertEqual(m, 'A test')
Esempio n. 7
0
 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'))
Esempio n. 8
0
 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'))
Esempio n. 9
0
 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')