With any testing, the key question really is - what could go wrong?
In your case, it looks like the three risks are:
- The web API in question could stop working. But you check for this already, with
assert r.ok
. - You, or someone else, could make a mistaken change to the code in future (e.g. mistyping a variable) which breaks it.
- The API could change, so that it no longer returns the fields or the format you need.
It feels like you could write a fairly simple test for the latter two, depending on what data from this API you actually rely on: for example, if you're expecting the JSON to have a field called "temperature" which is a floating-point Celsius number, you could write a test which calls your function, then checks that self.temperature is an instance of 'float' and is within a sensible range of values (-30 to 50?). That should leave you confident that both the API and your function are working as designed.