forked from Flow-Launcher/Flow.Launcher.PluginsManifest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
31 lines (20 loc) · 761 Bytes
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# -*-coding: utf-8 -*-
import json
# constants
plugin_info_file = 'plugins.json'
id_name = 'ID'
language_name = 'Language'
language_list = ('csharp', 'executable', 'fsharp', 'python')
# read `plugin_info_file`
with open(plugin_info_file) as f:
plugin_infos = json.loads(f.read())
def clean(old: str) -> str:
return old.lower().replace('-', '').strip()
def test_uuid_unique():
uuids = [plugin_info[id_name] for plugin_info in plugin_infos]
uuids = [clean(uuid) for uuid in uuids]
assert len(uuids) == len(set(uuids))
def test_language_in_list():
languages = [plugin_info[language_name] for plugin_info in plugin_infos]
languages = [clean(language) for language in languages]
assert set(language_list) >= set(languages)