

def test_log_source_by_node_collection_handler(self):
    node_ip = '10.20.0.130'
    node = self.env.create_node(api=False, ip=node_ip)
    resp = self.app.get(reverse('LogSourceByNodeCollectionHandler', kwargs={
        'node_id': node.id,
    }), headers=self.default_headers)
    self.assertEqual(200, resp.status_code)
    response = resp.json_body
    self.assertEqual(response, [])
    log_entry = ['date111', 'level222', 'text333']
    self._create_logfile_for_node(settings.LOGS[1], [log_entry], node)
    resp = self.app.get(reverse('LogSourceByNodeCollectionHandler', kwargs={
        'node_id': node.id,
    }), headers=self.default_headers)
    self.assertEqual(200, resp.status_code)
    self.assertEqual(resp.json_body, [settings.LOGS[1]])

dataset/ETHPy150Open openstack/fuel-web/nailgun/nailgun/test/unit/test_logs_handlers.py TestLogs.test_log_source_by_node_collection_handler/original