-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added additional tests to ensure safety of SVG loading
- Loading branch information
1 parent
f70ccac
commit 36a992f
Showing
1 changed file
with
23 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
import source | ||
import unittest | ||
import util | ||
from util import PathException | ||
|
||
|
||
class TestUtil(unittest.TestCase): | ||
|
||
def test_svg_valid(self): | ||
with source.app.app_context(): | ||
res = util.svg('success_checkmark.svg') | ||
self.assertIn('<svg', res) | ||
|
||
def test_svg_bad_extension(self): | ||
with source.app.app_context(): | ||
with self.assertRaises(PathException): | ||
util.svg('config.py') | ||
|
||
def test_svg_bad_path(self): | ||
with source.app.app_context(): | ||
with self.assertRaises(PathException): | ||
util.svg('../../../../etc/hosts') |