Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-taggit
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ab7160e2
authored
Sep 28, 2010
by
Gert Van Gool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added extra tests for TaggableManager (and the generated formfield)
parent
7fe3a0b9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
0 deletions
+22
-0
taggit/tests/tests.py
+22
-0
No files found.
taggit/tests/tests.py
View file @
ab7160e2
...
...
@@ -4,6 +4,7 @@ from django.conf import settings
from
django.db
import
connection
from
django.test
import
TestCase
,
TransactionTestCase
from
taggit.managers
import
TaggableManager
from
taggit.models
import
Tag
,
TaggedItem
from
taggit.tests.forms
import
(
FoodForm
,
DirectFoodForm
,
CustomPKFoodForm
,
OfficialFoodForm
)
...
...
@@ -430,3 +431,24 @@ class TagStringParseTestCase(UnitTestCase):
self
.
assertEqual
(
edit_string_for_tags
([
plain
,
spaces
,
comma
]),
u'"com,ma", "spa ces", plain'
)
self
.
assertEqual
(
edit_string_for_tags
([
plain
,
comma
]),
u'"com,ma", plain'
)
self
.
assertEqual
(
edit_string_for_tags
([
comma
,
spaces
]),
u'"com,ma", "spa ces"'
)
class
TagAdminFormTestCase
(
BaseTaggingTestCase
):
def
test_managers
(
self
):
tm
=
TaggableManager
(
verbose_name
=
'categories'
,
help_text
=
'Add some categories'
,
blank
=
True
)
self
.
assertEqual
(
tm
.
verbose_name
,
'categories'
)
self
.
assertEqual
(
tm
.
help_text
,
u'Add some categories'
)
self
.
assertEqual
(
tm
.
blank
,
True
)
def
test_formfield
(
self
):
tm
=
TaggableManager
(
verbose_name
=
'categories'
,
help_text
=
'Add some categories'
,
blank
=
True
)
ff
=
tm
.
formfield
()
self
.
assertEqual
(
ff
.
label
,
'categories'
)
self
.
assertEqual
(
ff
.
help_text
,
u'Add some categories'
)
self
.
assertEqual
(
ff
.
required
,
False
)
def
test_formfield_modified
(
self
):
tm
=
TaggableManager
(
verbose_name
=
'categories'
,
help_text
=
'Add some categories'
,
blank
=
True
)
ff
=
tm
.
formfield
(
required
=
True
,
help_text
=
'new help'
)
self
.
assertEqual
(
ff
.
label
,
'categories'
)
self
.
assertEqual
(
ff
.
help_text
,
'new help'
)
self
.
assertEqual
(
ff
.
required
,
True
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment