TST: Use pytest-localserver instead of making network connections
Since we have a lot of CI jobs with unit test that make network connections, it is better if the network connections could be made locally if possible. This PR refactors all tests that make network connections to use `pytest-localserver` instead
This broke the env on ARM Mac. pytest local server requires aiosmtpd which isn't available on Mac

Edit: Does anyone have bandwidth to look into it? Otherwise I'd revert this for now I am OK with revert unless @mroeschke has an objection Could we just remove pytest localserver from environment.yaml? This plugin helps save a few minutes from CI runtime and having the network rests run locally probably isn't a huge priority 