mirror of
https://github.com/inventree/InvenTree.git
synced 2025-05-03 22:08:49 +00:00
Coverage tests for new functions
This commit is contained in:
parent
d06018cbbe
commit
623a0844d3
@ -101,7 +101,7 @@ def isNull(text):
|
|||||||
True if the text looks like a null value
|
True if the text looks like a null value
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return str(text).strip().lower() in ['top', 'null', 'none', 'empty', 'false', '-1']
|
return str(text).strip().lower() in ['top', 'null', 'none', 'empty', 'false', '-1', '']
|
||||||
|
|
||||||
|
|
||||||
def decimal2string(d):
|
def decimal2string(d):
|
||||||
|
@ -72,6 +72,24 @@ class TestHelpers(TestCase):
|
|||||||
self.assertFalse(helpers.str2bool(s))
|
self.assertFalse(helpers.str2bool(s))
|
||||||
self.assertFalse(helpers.str2bool(s, test=False))
|
self.assertFalse(helpers.str2bool(s, test=False))
|
||||||
|
|
||||||
|
def test_isnull(self):
|
||||||
|
|
||||||
|
for s in ['null', 'none', '', '-1', 'false']:
|
||||||
|
self.assertTrue(helpers.isNull(s))
|
||||||
|
|
||||||
|
for s in ['yes', 'frog', 'llama', 'true']:
|
||||||
|
self.assertFalse(helpers.isNull(s))
|
||||||
|
|
||||||
|
def testStaticUrl(self):
|
||||||
|
|
||||||
|
self.assertEqual(helpers.getStaticUrl('test.jpg'), '/static/test.jpg')
|
||||||
|
self.assertEqual(helpers.getBlankImage(), '/static/img/blank_image.png')
|
||||||
|
self.assertEqual(helpers.getBlankThumbnail(), '/static/img/blank_image.thumbnail.png')
|
||||||
|
|
||||||
|
def testMediaUrl(self):
|
||||||
|
|
||||||
|
self.assertEqual(helpers.getMediaUrl('xx/yy.png'), '/media/xx/yy.png')
|
||||||
|
|
||||||
|
|
||||||
class TestQuoteWrap(TestCase):
|
class TestQuoteWrap(TestCase):
|
||||||
""" Tests for string wrapping """
|
""" Tests for string wrapping """
|
||||||
|
Loading…
x
Reference in New Issue
Block a user