diff --git a/tests/airdrop_index_v1_schema.json b/tests/airdrop_index_v1_schema.json index d1f55ef..6a1fe14 100644 --- a/tests/airdrop_index_v1_schema.json +++ b/tests/airdrop_index_v1_schema.json @@ -28,6 +28,9 @@ "icon": { "type": "string" }, + "icon_path": { + "type": "string" + }, "cutoff_time": { "type": "integer" }, diff --git a/tests/test_airdrops.py b/tests/test_airdrops.py index e57855d..985cedc 100644 --- a/tests/test_airdrops.py +++ b/tests/test_airdrops.py @@ -1,13 +1,23 @@ import json +import os from jsonschema import validate import pytest import requests def test_airdrops_metadata(): - airdrop_index = json.load(open('airdrops/index_v1.json')) - index_schema = json.load(open('tests/airdrop_index_v1_schema.json')) + with open('airdrops/index_v1.json', 'r') as f: + airdrop_index = json.load(f) + with open('tests/airdrop_index_v1_schema.json', 'r') as f: + index_schema = json.load(f) + validate(instance=airdrop_index, schema=index_schema) + + # check that the new files exists on their given path + for airdrop in airdrop_index['airdrops'].values(): + assert os.path.exists(airdrop['csv_path']) + if 'icon_path' in airdrop: + assert os.path.exists(airdrop['icon_path']) @pytest.mark.skip('It makes too many requests')