Skip to content

Commit

Permalink
Fix test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ChanTsune committed Jul 27, 2020
1 parent 4cdf960 commit ce86e29
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/tests/test_template_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class TestBoostTemplateTag(TestCase):


class TestBoostUrlTemplateTag(TestCase):

def test_urlencode(self):
from django_boost.templatetags.boost_url import urlencode
cases = [
Expand All @@ -32,15 +32,17 @@ def test_replace_parameters(self):
from django_boost.templatetags.boost_url import replace_parameters

cases = [
("", ('p', 'p'), "p=p"),
("q=q", ('p', 'p'), "q=q&p=p"),
("q=q", ('q', 'x', 'p', 'p'), "q=x&p=p"),
("", ('p', 'p'), ("p=p",)),
("q=q", ('p', 'p'), ("q=q", "p=p")),
("q=q", ('q', 'x', 'p', 'p'), ("q=x", "p=p")),
]
factory = RequestFactory()
for qs, args, expected in cases:
request = factory.request(**{'QUERY_STRING': qs})
self.assertEqual(replace_parameters(request, *args), expected)

actual = replace_parameters(request, *args)
for e in expected:
self.assertIn(e, actual)

with self.assertRaises(LookupError):
request = factory.request()
replace_parameters(request, 'q')
Expand All @@ -59,7 +61,6 @@ def test_get_querystring(self):
self.assertEqual(get_querystring(request, key), value)



class TestBoostQueryTemplateTag(TestCase):
pass

Expand Down

0 comments on commit ce86e29

Please sign in to comment.