I have a class like this (simplified):
class DataGainer:
def __init__(self):
self.last_url = None
def get_data(self, url):
response = requests.get(url) # very long request
self.last_url = response.url
...
As a test I'd like to make sure, that after the request I have correct url in the last_url property. So I do not care, what data will be returned by get, but I need to have Response object with url. That is why I can't use mock. Maybe there is a way to pass timeout argument somehow?
My test so far looks this way (simplified):
def test_last_url():
url = 'some.url'
dg = DataGainer()
dg.get_data(url)
assert dg.last_url == url
This test is very slow, because of the get request. How can I make it faster?
P.s.: I'd like to check last_url because I process it somehow