Exemple #1
0
    def test_poll_cache(self, _poll):
        # only gets called once in interval
        plugins = Plugins('http://', self.J, poll_cache_timeout=1)
        for i in range(2):
            plugins.poll()
        self.assertEquals(_poll.call_count, 1)
        plugins.poll(True)  # test force poll
        self.assertEquals(_poll.call_count, 2)

        # ensure it gets called again after cache timeout
        _poll.reset_mock()
        time.sleep(1.1)
        plugins.poll()
        self.assertTrue(_poll.called)

        # ensure it is disabled by default
        _poll.reset_mock()
        plugins = self.J.get_plugins()
        for i in range(2):
            plugins.poll()
        self.assertEquals(_poll.call_count, 3)  # get plugins triggers a poll
        self.assertIsNone(plugins.poll_cache_expires)
Exemple #2
0
 def get_plugins(self):
     url = self.get_plugins_url()
     return Plugins(url, self)
Exemple #3
0
 def get_plugins(self, depth=1):
     url = self.get_plugins_url(depth=depth)
     return Plugins(url, self)