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
28
tests/test_schema.py
Normal file
28
tests/test_schema.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import os
|
||||
import json
|
||||
import pytest
|
||||
from jsonschema import validate
|
||||
from jsonschema.exceptions import ValidationError
|
||||
|
||||
|
||||
def test_os_list_json_against_schema(oslisttuple, schema):
|
||||
oslisturl = oslisttuple[0]
|
||||
oslistdata = oslisttuple[1]
|
||||
errorMsg = ""
|
||||
|
||||
j = json.loads(oslistdata)
|
||||
|
||||
try:
|
||||
validate(instance=j, schema=schema)
|
||||
except ValidationError as err:
|
||||
errorMsg = err.message
|
||||
|
||||
if errorMsg != "":
|
||||
pytest.fail(oslisturl+" failed schema validation: "+errorMsg, False)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def schema():
|
||||
f = open(os.path.dirname(__file__)+"/../doc/json-schema/os-list-schema.json","r")
|
||||
data = f.read()
|
||||
return json.loads(data)
|
Loading…
Add table
Add a link
Reference in a new issue