def METHOD_NAME(self):
    data_source = self.factory.create_data_source()
    query = self.factory.create_query(data_source=data_source)
    data_source.delete()
    self.assertIsNone(DataSource.query.get(data_source.id))
    self.assertIsNone(Query.query.get(query.id).data_source_id)