def METHOD_NAME(self):
    data_source = self.factory.create_data_source()
    self.factory.create_query_result(data_source=data_source)
    self.factory.create_query(
        data_source=data_source,
        latest_query_data=self.factory.create_query_result(data_source=data_source),
    )
    data_source.delete()
    self.assertIsNone(DataSource.query.get(data_source.id))
    self.assertEqual(0, QueryResult.query.filter(QueryResult.data_source == data_source).count())