So I want to write this function that downloads a file and unpacks it in python using TDD.
The function will look like this approximately
import urllib.request
import tarfile
def download_and_unpack(tarball_url, destination)
datastream = urllib.request.urlopen(tarball_url)
thetarfile = tarfile.open(fileobj=datastream, mode="r|gz")
thetarfile.extractall(destination)
Now, I don't want to test the implementation but the behaviour, and I don't need to test the python standard library, so I don't know where to start.
I was thinking of creating a tarball in /tmp, pass it to the function and see that the files are unpacked, but that feels like testing too much at once. Any pointers or advice on how to start here?
As someone suggested, I could wrap each line in a custom interface and test the function by mocking these instead, but then I would have to test the interfaces themselves, and I feel I would end up in the same dead end...