mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-17 23:45:21 +01:00
Add integration tests
Tests if repository json files conform to the json schema. If all resources (images/icons/website URLs) they mention actually exists. And can also test writing images and the FAT modification code.
This commit is contained in:
parent
fce80b2a67
commit
05f1c4dbb5
11 changed files with 319 additions and 8 deletions
25
tests/test_urls.py
Normal file
25
tests/test_urls.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
import urllib.request
|
||||
|
||||
def _head_request(url):
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=None,
|
||||
headers={
|
||||
'User-Agent': 'rpi-imager automated tests'
|
||||
},
|
||||
method="HEAD"
|
||||
)
|
||||
return urllib.request.urlopen(req)
|
||||
|
||||
|
||||
def test_icon_url_exists(iconurl):
|
||||
assert _head_request(iconurl).status == 200
|
||||
|
||||
def test_website_url_exists(websiteurl):
|
||||
assert _head_request(websiteurl).status == 200
|
||||
|
||||
def test_image_url_exists_and_has_correct_image_download_size(imageitem):
|
||||
response = _head_request(imageitem["url"])
|
||||
|
||||
assert response.status == 200
|
||||
assert str(imageitem["image_download_size"]) == response.headers["Content-Length"]
|
Loading…
Add table
Add a link
Reference in a new issue