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:
Floris Bos 2022-11-19 23:49:43 +01:00
parent fce80b2a67
commit 05f1c4dbb5
11 changed files with 319 additions and 8 deletions

30
tests/README.md Normal file
View file

@ -0,0 +1,30 @@
Integration tests
===
Test if all json files in the public repository are correct (validate against json schema, and test all image files, icons and websites mentioned in the json do exist by performing HEAD requests)
```
$ cd tests
$ pytest
```
Test if a specific json file validates correctly
```
$ cd tests
$ pytest --repo=http://my-repo/os_list.json
```
Test image writes for all images in a repository
```
$ cd tests
$ truncate -s 16G loopfile
$ udisksctl loop-setup --file loopfile
Mapped file loopfile as /dev/loop24
$ sudo -g disk pytest test_write_images.py --repo=http://my-repo/os_list.json --device=/dev/loop24
```
Note: make sure automatic mounting of removable media is disabled in your Linux distribution during write tests.
You can also use real drives instead of loop files as device. But be very careful not to enter the wrong device. Writes are done for real, it is not a mock test...