Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
8a9c3c49
Commit
8a9c3c49
authored
Jul 18, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test better suggestion manipulations
parent
6d2a204a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
trans/tests/views.py
trans/tests/views.py
+11
-2
No files found.
trans/tests/views.py
View file @
8a9c3c49
...
@@ -584,21 +584,25 @@ class SuggestionsTest(ViewTestCase):
...
@@ -584,21 +584,25 @@ class SuggestionsTest(ViewTestCase):
self
.
assertEqual
(
len
(
unit
.
checks
()),
0
)
self
.
assertEqual
(
len
(
unit
.
checks
()),
0
)
self
.
assertFalse
(
unit
.
translated
)
self
.
assertFalse
(
unit
.
translated
)
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertEquals
(
len
(
self
.
get_unit
().
suggestions
()),
2
)
def
test_delete
(
self
):
def
test_delete
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
# Create two suggestions
# Create two suggestions
self
.
add_suggestion_1
()
self
.
add_suggestion_1
()
self
.
add_suggestion_2
()
self
.
add_suggestion_2
()
# Get ids of created suggestions
# Get ids of created suggestions
suggestions
=
[
sug
.
pk
for
sug
in
self
.
get_unit
().
suggestions
()]
suggestions
=
[
sug
.
pk
for
sug
in
self
.
get_unit
().
suggestions
()]
self
.
assertEquals
(
len
(
suggestions
),
2
)
# Delete one of suggestions
# Delete one of suggestions
self
.
edit_unit
(
response
=
self
.
edit_unit
(
'Hello, world!
\
n
'
,
'Hello, world!
\
n
'
,
''
,
''
,
delete
=
suggestions
[
0
],
delete
=
suggestions
[
0
],
)
)
self
.
assertRedirectsOffset
(
response
,
translate_url
,
0
)
# Reload from database
# Reload from database
unit
=
self
.
get_unit
()
unit
=
self
.
get_unit
()
...
@@ -613,21 +617,25 @@ class SuggestionsTest(ViewTestCase):
...
@@ -613,21 +617,25 @@ class SuggestionsTest(ViewTestCase):
self
.
assertEqual
(
len
(
unit
.
checks
()),
0
)
self
.
assertEqual
(
len
(
unit
.
checks
()),
0
)
self
.
assertFalse
(
unit
.
translated
)
self
.
assertFalse
(
unit
.
translated
)
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertEquals
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
def
test_accept
(
self
):
def
test_accept
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
# Create two suggestions
# Create two suggestions
self
.
add_suggestion_1
()
self
.
add_suggestion_1
()
self
.
add_suggestion_2
()
self
.
add_suggestion_2
()
# Get ids of created suggestions
# Get ids of created suggestions
suggestions
=
[
sug
.
pk
for
sug
in
self
.
get_unit
().
suggestions
()]
suggestions
=
[
sug
.
pk
for
sug
in
self
.
get_unit
().
suggestions
()]
self
.
assertEquals
(
len
(
suggestions
),
2
)
# Accept one of suggestions
# Accept one of suggestions
self
.
edit_unit
(
response
=
self
.
edit_unit
(
'Hello, world!
\
n
'
,
'Hello, world!
\
n
'
,
''
,
''
,
accept
=
suggestions
[
1
],
accept
=
suggestions
[
1
],
)
)
self
.
assertRedirectsOffset
(
response
,
translate_url
,
0
)
# Reload from database
# Reload from database
unit
=
self
.
get_unit
()
unit
=
self
.
get_unit
()
...
@@ -643,6 +651,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -643,6 +651,7 @@ class SuggestionsTest(ViewTestCase):
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertFalse
(
unit
.
fuzzy
)
self
.
assertEqual
(
unit
.
target
,
'Ahoj svete!
\
n
'
)
self
.
assertEqual
(
unit
.
target
,
'Ahoj svete!
\
n
'
)
self
.
assertBackend
(
1
)
self
.
assertBackend
(
1
)
self
.
assertEquals
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
def
test_vote
(
self
):
def
test_vote
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
translate_url
=
self
.
get_translation
().
get_translate_url
()
...
...
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