From 163d0021a7f10fd1d150065e978538342a193890 Mon Sep 17 00:00:00 2001 From: OjusWiZard Date: Wed, 14 Feb 2024 22:17:46 +0530 Subject: [PATCH] Fix (Airdrops): Optional icon_path Signed-off-by: OjusWiZard --- tests/airdrop_index_v1_schema.json | 4 +++- tests/test_airdrops.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/airdrop_index_v1_schema.json b/tests/airdrop_index_v1_schema.json index d1f55ef..e7191a1 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" }, @@ -131,7 +134,6 @@ "required": [ "asset_identifier", "csv_path", - "icon", "name", "url" ] diff --git a/tests/test_airdrops.py b/tests/test_airdrops.py index e57855d..d1ebf30 100644 --- a/tests/test_airdrops.py +++ b/tests/test_airdrops.py @@ -1,4 +1,5 @@ import json +import os from jsonschema import validate import pytest import requests @@ -62,3 +63,13 @@ def test_data_migration(): assert airdrop_name in new_index['poap_airdrops'] with open(new_index['poap_airdrops'][airdrop_name][0], 'r') as f: assert requests.get(airdrop_url).text.strip() == f.read().strip() + + +def test_new_files_exists(): + with open('airdrops/index_v1.json', 'r') as f: + index = json.load(f) + + for airdrop in index['airdrops'].values(): + assert os.path.exists(airdrop['csv_path']) + if 'icon_path' in airdrop: + assert os.path.exists(airdrop['icon_path'])