generated from geoadmin/template-service-flask
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PB-227: Added tests for babs2 helptext
- Loading branch information
Showing
4 changed files
with
35 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import json | ||
import os | ||
|
||
from tests.unit_tests.base_test import ServiceIconsUnitTests | ||
|
||
from app.settings import JSON_FOLDER | ||
|
||
def validateJSON(jsonData): | ||
try: | ||
json.loads(jsonData) | ||
except ValueError as err: | ||
return False | ||
return True | ||
|
||
class IconsTests(ServiceIconsUnitTests): | ||
|
||
def test_json(self): | ||
path = os.path.abspath(os.path.join(JSON_FOLDER, 'babs2_dictionary.json')) | ||
self.assertTrue(os.path.exists(path),"babs2 json file doesn't exist") | ||
|
||
for root, dirs, files in os.walk(os.path.join(JSON_FOLDER)): | ||
for name in files: | ||
p = os.path.join(root, name) | ||
with open(p) as f: | ||
json_file = f.read() | ||
self.assertTrue(validateJSON(json_file),"json file validation failed") | ||
|