@mock.patch.object(timeutils, 'utcnow', autospec=True)
def test_get_nodeinfo_list_inspection(self, mock_utcnow):
    past = datetime.datetime(2000, 1, 1, 0, 0)
    next = (past + datetime.timedelta(minutes=8))
    present = (past + datetime.timedelta(minutes=10))
    mock_utcnow.return_value = past
    node1 = utils.create_test_node(uuid=uuidutils.generate_uuid(), inspection_started_at=past)
    node2 = utils.create_test_node(uuid=uuidutils.generate_uuid(), provision_state=states.INSPECTING)
    utils.create_test_node(uuid=uuidutils.generate_uuid(), inspection_started_at=next)
    mock_utcnow.return_value = present
    res = self.dbapi.get_nodeinfo_list(filters={'inspection_started_before': 300})
    self.assertEqual([node1.id], [r[0] for r in res])
    res = self.dbapi.get_nodeinfo_list(filters={'provision_state': states.INSPECTING})
    self.assertEqual([node2.id], [r[0] for r in res])
@mock.patch.object(timeutils, 'utcnow', autospec=True)
def test_get_nodeinfo_list_inspection(self, mock_utcnow):
    past = datetime.datetime(2000, 1, 1, 0, 0)
    next = (past + datetime.timedelta(minutes=8))
    present = (past + datetime.timedelta(minutes=10))
    mock_utcnow.return_value = past
    node1 = utils.create_test_node(uuid=uuidutils.generate_uuid(), inspection_started_at=past)
    node2 = utils.create_test_node(uuid=uuidutils.generate_uuid(), provision_state=states.INSPECTING)
    utils.create_test_node(uuid=uuidutils.generate_uuid(), inspection_started_at=next)
    mock_utcnow.return_value = present
    res = self.dbapi.get_nodeinfo_list(filters={'inspection_started_before': 300})
    self.assertEqual([node1.id], [r[0] for r in res])
    res = self.dbapi.get_nodeinfo_list(filters={'provision_state': states.INSPECTING})
    self.assertEqual([node2.id], [r[0] for r in res])