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.
- Loading branch information
Showing
14 changed files
with
195 additions
and
393 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,6 @@ nose2 = "*" | |
pylint = "*" | ||
pylint-flask = "*" | ||
cairosvg = "*" | ||
pandas3 = "*" | ||
|
||
[requires] | ||
python_version = "3.9" |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -579,4 +579,4 @@ | |
"fr": "Point de rassemblement d'urgence", | ||
"it": "Punto di raccolta d'urgenza" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import argparse | ||
import json | ||
|
||
# pylint: disable=import-error | ||
import pandas as pd | ||
|
||
|
||
|
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,57 @@ | ||
import json | ||
import os | ||
|
||
from flask import url_for | ||
|
||
from app.settings import DESCRIPTION_FOLDER | ||
from tests.unit_tests.base_test import ServiceIconsUnitTests | ||
|
||
|
||
def validate_json(json_file): | ||
try: | ||
json.loads(json_file) | ||
except ValueError as err: | ||
return False | ||
return True | ||
|
||
|
||
class IconsTests(ServiceIconsUnitTests): | ||
|
||
def test_validate_json_description_files(self): | ||
files = list(os.listdir(DESCRIPTION_FOLDER)) | ||
for file in files: | ||
for root, dirs, files in os.walk(os.path.join(DESCRIPTION_FOLDER)): | ||
for name in files: | ||
p = os.path.join(root, name) | ||
with open(p, encoding='utf-8') as f: | ||
json_file = f.read() | ||
self.assertTrue( | ||
validate_json(json_file), "validation failed of json file: " + file | ||
) | ||
|
||
def test_get_icon_set_description_valid(self): | ||
response = self.app.get( | ||
url_for( | ||
'description_from_icon_set', | ||
icon_set_name='babs-I', | ||
), | ||
headers={"Origin": 'www.example.com'} | ||
) | ||
self.assertEqual(response.status_code, 200) | ||
|
||
def test_get_icon_set_description_invalid(self): | ||
response = self.app.get( | ||
url_for( | ||
'description_from_icon_set', | ||
icon_set_name='default', | ||
), | ||
headers={"Origin": 'www.example.com'} | ||
) | ||
self.assertEqual( | ||
response.json, { | ||
"error": { | ||
"code": 404, "message": "Description dictionary not found" | ||
}, | ||
"success": False | ||
} | ||
) |
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 was deleted.
Oops, something went wrong.