Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d81da9df
Commit
d81da9df
authored
Jan 29, 2013
by
Jay Zoldak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for django comment client mustache helpers
parent
593b0387
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
lms/djangoapps/django_comment_client/mustache_helpers.py
+2
-0
lms/djangoapps/django_comment_client/tests/test_mustache_helpers.py
+26
-0
No files found.
lms/djangoapps/django_comment_client/mustache_helpers.py
View file @
d81da9df
...
...
@@ -5,6 +5,8 @@ import urllib
import
sys
import
inspect
# This method is used to pluralize the words "discussion" and "comment"
# which is why you need to tack on an "s" for the case of 0 or two or more.
def
pluralize
(
content
,
text
):
num
,
word
=
text
.
split
(
' '
)
num
=
int
(
num
or
'0'
)
...
...
lms/djangoapps/django_comment_client/tests/test_mustache_helpers.py
0 → 100644
View file @
d81da9df
import
string
import
random
import
collections
from
django.test
import
TestCase
import
django_comment_client.mustache_helpers
as
mustache_helpers
class
PluralizeTestCase
(
TestCase
):
def
test_pluralize
(
self
):
self
.
text1
=
'0 goat'
self
.
text2
=
'1 goat'
self
.
text3
=
'7 goat'
self
.
content
=
'unused argument'
self
.
assertEqual
(
mustache_helpers
.
pluralize
(
self
.
content
,
self
.
text1
),
'goats'
)
self
.
assertEqual
(
mustache_helpers
.
pluralize
(
self
.
content
,
self
.
text2
),
'goat'
)
self
.
assertEqual
(
mustache_helpers
.
pluralize
(
self
.
content
,
self
.
text3
),
'goats'
)
class
CloseThreadTextTestCase
(
TestCase
):
def
test_close_thread_text
(
self
):
self
.
contentClosed
=
{
'closed'
:
True
}
self
.
contentOpen
=
{
'closed'
:
False
}
self
.
assertEqual
(
mustache_helpers
.
close_thread_text
(
self
.
contentClosed
),
'Re-open thread'
)
self
.
assertEqual
(
mustache_helpers
.
close_thread_text
(
self
.
contentOpen
),
'Close thread'
)
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