Exemple #1
0
    def test_get_by_project_id(self, project_id_from_db):
        db_mapping = get_db_mapping()
        project_id_from_db.return_value = [db_mapping]

        mapping_obj = objects.InstanceMappingList().get_by_project_id(
            self.context, db_mapping['project_id'])
        project_id_from_db.assert_called_once_with(self.context,
                                                   db_mapping['project_id'])
        self.compare_obj(mapping_obj.objects[0], db_mapping)
Exemple #2
0
    def test_get_by_project_id(self, project_id_from_db):
        db_mapping = get_db_mapping()
        project_id_from_db.return_value = [db_mapping]

        mapping_obj = objects.InstanceMappingList().get_by_project_id(
                self.context, db_mapping['project_id'])
        project_id_from_db.assert_called_once_with(self.context,
                db_mapping['project_id'])
        self.compare_obj(mapping_obj.objects[0], db_mapping,
                         subs={'cell_mapping': 'cell_id'},
                         comparators={
                             'cell_mapping': self._check_cell_map_value})
Exemple #3
0
def fake_get_by_instance_uuids(cls, context, uuids):
    mappings = [im for im in fake_instance_mappings
                if im.instance_uuid in uuids]
    return objects.InstanceMappingList(objects=mappings)