Closed MasterOdin closed 7 years ago
Not sure the best way to add tests for this, open to suggestions.
You could try fetching something by literally using example.com as a mirror.
That would test the case where the mirror exists, but text itself couldn't found, but I couldn't seem to get a good test of "the mirror doesn't exist, it fails", but I guess that might just be something screwy with my network settings affecting python.
Perhaps something like thismirrordoesntexist.com?
Weirdly:
>>> import requests
>>> response = requests.head("http://thismirrordoesntexist.com")
>>> response.ok
True
>>> response.status_code
301
I'm going to have to figure out what's going on with my network stack, so I cannot write tests at this time.
I think this @coveralls comment spam could be turned off, especially when it's so useless ("changes unknown"?) but keep the status API:
@hugovk Sounds great, please do turn off the spam :)
@c-w I don't have the rights for this repo, please can you do it?
@hugovk Should be done now.
Closes #81
General usage for allowing the end user to specify a mirror to use:
(the printed URI is just for the example, won't happen in real usage)
I've also added an additional exception in using an invalid mirror (ie, URI doesn't exist, forbidden, etc):
And if you use a good mirror, but the etext does not exist (this will return an empty message in current version):