Skip to content

Commit

Permalink
Test for tag_joiner()
Browse files Browse the repository at this point in the history
  • Loading branch information
nshafer committed Aug 2, 2016
1 parent b222722 commit 7d66828
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.test import TestCase
from taggit.models import Tag

from taggit_selectize.utils import parse_tags
from taggit_selectize.utils import parse_tags, join_tags


class TestUtils(TestCase):
Expand Down Expand Up @@ -49,5 +50,15 @@ def test_tag_parser_extra_closing_quote(self):
def test_tag_parser_extra_quotes_and_commas(self):
self.assertListEqual(parse_tags('""foo,",bar",,baz"""'), [',bar', 'baz', 'foo'])

def test_tag_joiner(self):
foo = Tag(name="foo", slug="foo")
bar = Tag(name="bar", slug="bar")
self.assertEqual(join_tags([foo, bar]), "bar,foo")

with self.settings(TAGGIT_SELECTIZE={'DELIMITER': ';'}):
self.assertEqual(join_tags([foo, bar]), "bar;foo")





0 comments on commit 7d66828

Please sign in to comment.