예제 #1
0
    def test_configured_init(self, handler):
        token = 'azertyuiop123456789'
        crawler = Mock()
        crawler.settings = {'LOGENTRIES_TOKEN': token, }

        extension = LogentriesExtension.from_crawler(crawler)

        handler.assert_called_once_with(token)
        extension.handler
예제 #2
0
    def test_unconfigured_init(self):
        crawler = Mock()
        crawler.settings = {'LOGENTRIES_TOKEN': None, }

        with self.assertRaises(NotConfigured):
            self.extension = LogentriesExtension.from_crawler(crawler)