Your boundaries matter here.
There could be downsides to asking, of course. You cannot prevent someone from being bothered by asking. It might mean you get to have less sex. It also might not guarantee honesty. It might mean a few awkward conversations while you figure out your limits alongside your scripts.
But, personally, as someone who fucks any hole that wiggles in front of me, as least for a brief plunge, I would be turned on by someone asking about my testing. Let’s say you said, “Hey, I’m trying to be the best cumdump I can be, and stay in commission for as long as possible. Can you let me know when you were last tested and whether you know if you had any positive results?” I would happily oblige.
It’s not unethical or illegal to ask for someone’s medical details as an individual person making choices about your sexual behavior. It might be a social faux pas to some people, and it’s up to you how you want to navigate your social group.