Skip to content

Commit

Permalink
added additional tests to ensure safety of SVG loading
Browse files Browse the repository at this point in the history
  • Loading branch information
heartsucker committed Feb 5, 2017
1 parent f70ccac commit 36a992f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions securedrop/tests/test_unit_util.py
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')

0 comments on commit 36a992f

Please sign in to comment.