'Ensure we can retrieve faults for instance.'

def test_instance_fault_get_by_instance(self):

    uuids = [uuidsentinel.uuid1, uuidsentinel.uuid2]
    fault_codes = [404, 500]
    expected = {}
    for uuid in uuids:
        db.instance_create(self.ctxt, {'uuid': uuid})
        expected[uuid] = []
        for code in fault_codes:
            fault_values = self._create_fault_values(uuid, code)
            fault = db.instance_fault_create(self.ctxt, fault_values)
            expected[uuid].insert(0, fault)
    faults = db.instance_fault_get_by_instance_uuids(self.ctxt, uuids)
    self.assertEqual(len(expected), len(faults))
    for uuid in uuids:
        self._assertEqualOrderedListOfObjects(expected[uuid], faults[uuid])
