File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -91,3 +91,13 @@ def check_url(url: str) -> bool:
9191 re .IGNORECASE ,
9292 )
9393 return re .match (regex , url ) is not None
94+
95+
96+ def get_file_plugins_json_info (required_key : str = "" ) -> list [dict [str , str ]]:
97+ with open ("plugins.json" , "r" , encoding = "utf-8" ) as f :
98+ data = json .load (f )
99+
100+ if not required_key :
101+ return data
102+
103+ return [{required_key : plugin [required_key ]} for plugin in data ]
Original file line number Diff line number Diff line change @@ -39,3 +39,19 @@ def test_file_name_construct():
3939 assert (
4040 f"{ info ['Name' ]} -{ info ['ID' ]} .json" in filenames
4141 ), f"Plugin { info ['Name' ]} with ID { info ['ID' ]} does not have the correct filename. Make sure it's name + ID, i.e. { info ['Name' ]} -{ info ['ID' ]} .json"
42+
43+ def test_submitted_plugin_id_is_valid_uuid ():
44+ plugins_json_ids = [item ["ID" ] for item in get_file_plugins_json_info ("ID" )]
45+ existing_plugin_file_ids = [info ["ID" ] for info in plugin_infos ]
46+
47+ for id in existing_plugin_file_ids :
48+ if id in plugins_json_ids :
49+ continue
50+
51+ try :
52+ uuid .UUID (id , version = 4 )
53+ outcome = True
54+ except ValueError :
55+ outcome = False
56+
57+ assert outcome is True , f"The submission plugin ID { id } is not a valid v4 UUID"
You can’t perform that action at this time.
0 commit comments