Commit dabd6d1a authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Fix import and add main to unittests

parent 3ab85869
import sys
from synnefo.webproject.management import util
from synnefo.webproject.management import utils
# Use backported unittest functionality if Python < 2.7
try:
......@@ -12,17 +12,20 @@ except ImportError:
class ParseFiltersTestCase(unittest.TestCase):
def test_parse_empty(self):
res = util.parse_filters("")
res = utils.parse_filters("")
self.assertEqual(res, ({}, {}))
def test_parse_one(self):
res = util.parse_filters("x=2")
res = utils.parse_filters("x=2")
self.assertEqual(res, ({"x": "2"}, {}))
res = util.parse_filters("x!=2")
res = utils.parse_filters("x!=2")
self.assertEqual(res, ({}, {"x": "2"}))
def test_parse_many(self):
res = util.parse_filters("x=2,x>=3,y!=4,z<3")
res = utils.parse_filters("x=2,x>=3,y!=4,z<3")
filters = {"x": "2", "x__gte": "3", "z__lt": "3"}
excludes = {"y": "4"}
self.assertEqual(res, (filters, excludes))
if __name__ == '__main__':
unittest.main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment