def test_reload(self, mock_client):
        mock_client.return_value.reload_needed.return_value = False
        self.assertFalse(model.reload_needed())
        mock_client.return_value.reload_needed.return_value = True
        self.assertTrue(model.reload_needed())

        mock_client.return_value.get_version.return_value = "1"
        mock_client.return_value.get_dhcp_server.return_value = {"name": "fake"}
        mock_client.return_value.get_dns_server.return_value = {"name": "fake"}
        model.reload_server()
        self.assertTrue(mock_client.return_value.reload_server.called)
Beispiel #2
0
    def test_reload(self, mock_client):
        mock_client.return_value.reload_needed.return_value = False
        self.assertFalse(model.reload_needed())
        mock_client.return_value.reload_needed.return_value = True
        self.assertTrue(model.reload_needed())

        mock_client.return_value.get_version.return_value = "1"
        mock_client.return_value.get_dhcp_server.return_value = {
            'name': 'fake'}
        mock_client.return_value.get_dns_server.return_value = {
            'name': 'fake'}
        model.reload_server()
        self.assertTrue(mock_client.return_value.reload_server.called)
 def _process_queue(cls):
     global last_activity
     last_activity = time.time()
     pool = eventlet.greenpool.GreenPool(size=GREENPOOL_SIZE)
     while True:
         try:
             funcall = _queue.get(timeout=1)
         except eventlet.queue.Empty:
             funcall = None
         if funcall:
             pool.spawn_n(funcall[0], *funcall[1], **funcall[2])
             last_activity = time.time()
         if model.reload_needed() and time.time() - last_activity > 1:
             pool.waitall()
             model.reload_server()
             last_activity = time.time()
Beispiel #4
0
 def _process_queue(cls):
     global last_activity
     last_activity = time.time()
     pool = eventlet.greenpool.GreenPool(size=GREENPOOL_SIZE)
     while True:
         try:
             funcall = _queue.get(timeout=1)
         except eventlet.queue.Empty:
             funcall = None
         if funcall:
             pool.spawn_n(funcall[0], *funcall[1], **funcall[2])
             last_activity = time.time()
         if model.reload_needed() and time.time() - last_activity > 1:
             pool.waitall()
             model.reload_server()
             last_activity = time.time()