示例#1
0
    def test_poll_cache(self, _poll):
        # only gets called once in interval
        ns = Nodes('http://', self.J, poll_cache_timeout=1)
        for i in range(2):
            ns.poll()
        self.assertEquals(_poll.call_count, 1)
        ns.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)
        ns.poll()
        self.assertTrue(_poll.called)

        # ensure it is disabled by default
        _poll.reset_mock()
        for i in range(2):
            self.ns.poll()
        self.assertEquals(_poll.call_count, 2)
        self.assertIsNone(self.ns.poll_cache_expires)
示例#2
0
 def get_nodes(self):
     url = self.get_nodes_url()
     return Nodes(url, self)
示例#3
0
 def get_nodes(self):
     return Nodes(self.baseurl, self)