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
81b9ebb3
Commit
81b9ebb3
authored
Nov 20, 2013
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not use deprecated methods
parent
20d91f4c
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
20 deletions
+20
-20
accounts/tests.py
accounts/tests.py
+2
-2
trans/tests/test_debug.py
trans/tests/test_debug.py
+1
-1
trans/tests/test_formats.py
trans/tests/test_formats.py
+4
-4
trans/tests/test_hooks.py
trans/tests/test_hooks.py
+4
-4
trans/tests/test_naturaldate.py
trans/tests/test_naturaldate.py
+1
-1
trans/tests/test_views.py
trans/tests/test_views.py
+8
-8
No files found.
accounts/tests.py
View file @
81b9ebb3
...
@@ -543,7 +543,7 @@ class CaptchaTest(UnitTestCase):
...
@@ -543,7 +543,7 @@ class CaptchaTest(UnitTestCase):
question
=
'1 + 1'
question
=
'1 + 1'
timestamp
=
1000
timestamp
=
1000
hashed
=
hash_question
(
question
,
timestamp
)
hashed
=
hash_question
(
question
,
timestamp
)
self
.
assertEqual
s
(
self
.
assertEqual
(
(
question
,
timestamp
),
(
question
,
timestamp
),
unhash_question
(
hashed
)
unhash_question
(
hashed
)
)
)
...
@@ -572,7 +572,7 @@ class CaptchaTest(UnitTestCase):
...
@@ -572,7 +572,7 @@ class CaptchaTest(UnitTestCase):
captcha
.
validate
(
2
)
captcha
.
validate
(
2
)
)
)
restored
=
MathCaptcha
.
from_hash
(
captcha
.
hashed
)
restored
=
MathCaptcha
.
from_hash
(
captcha
.
hashed
)
self
.
assertEqual
s
(
self
.
assertEqual
(
captcha
.
question
,
captcha
.
question
,
restored
.
question
restored
.
question
)
)
...
...
trans/tests/test_debug.py
View file @
81b9ebb3
...
@@ -27,7 +27,7 @@ class ReportFilterTest(TestCase):
...
@@ -27,7 +27,7 @@ class ReportFilterTest(TestCase):
def
test_report_none
(
self
):
def
test_report_none
(
self
):
reporter
=
WeblateExceptionReporterFilter
()
reporter
=
WeblateExceptionReporterFilter
()
result
=
reporter
.
get_request_repr
(
None
)
result
=
reporter
.
get_request_repr
(
None
)
self
.
assertEqual
s
(
self
.
assertEqual
(
'None'
,
'None'
,
result
result
)
)
...
...
trans/tests/test_formats.py
View file @
81b9ebb3
...
@@ -43,9 +43,9 @@ class AutoFormatTest(TestCase):
...
@@ -43,9 +43,9 @@ class AutoFormatTest(TestCase):
def
test_parse
(
self
):
def
test_parse
(
self
):
storage
=
self
.
FORMAT
(
self
.
FILE
)
storage
=
self
.
FORMAT
(
self
.
FILE
)
self
.
assertEqual
s
(
storage
.
count_units
(),
self
.
COUNT
)
self
.
assertEqual
(
storage
.
count_units
(),
self
.
COUNT
)
self
.
assertEqual
s
(
storage
.
mimetype
,
self
.
MIME
)
self
.
assertEqual
(
storage
.
mimetype
,
self
.
MIME
)
self
.
assertEqual
s
(
storage
.
extension
,
self
.
EXT
)
self
.
assertEqual
(
storage
.
extension
,
self
.
EXT
)
def
test_find
(
self
):
def
test_find
(
self
):
storage
=
self
.
FORMAT
(
self
.
FILE
)
storage
=
self
.
FORMAT
(
self
.
FILE
)
...
@@ -54,7 +54,7 @@ class AutoFormatTest(TestCase):
...
@@ -54,7 +54,7 @@ class AutoFormatTest(TestCase):
if
self
.
COUNT
==
0
:
if
self
.
COUNT
==
0
:
self
.
assertTrue
(
unit
is
None
)
self
.
assertTrue
(
unit
is
None
)
else
:
else
:
self
.
assertEqual
s
(
unit
.
get_target
(),
u'Ahoj světe!
\
n
'
)
self
.
assertEqual
(
unit
.
get_target
(),
u'Ahoj světe!
\
n
'
)
def
test_add
(
self
):
def
test_add
(
self
):
if
self
.
FORMAT
.
supports_new_language
():
if
self
.
FORMAT
.
supports_new_language
():
...
...
trans/tests/test_hooks.py
View file @
81b9ebb3
...
@@ -238,24 +238,24 @@ class HooksViewTest(ViewTestCase):
...
@@ -238,24 +238,24 @@ class HooksViewTest(ViewTestCase):
'project'
:
self
.
subproject
.
project
.
slug
'project'
:
self
.
subproject
.
project
.
slug
})
})
)
)
self
.
assertEqual
s
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
response
=
self
.
client
.
get
(
response
=
self
.
client
.
get
(
reverse
(
'hook-subproject'
,
kwargs
=
{
reverse
(
'hook-subproject'
,
kwargs
=
{
'project'
:
self
.
subproject
.
project
.
slug
,
'project'
:
self
.
subproject
.
project
.
slug
,
'subproject'
:
self
.
subproject
.
slug
,
'subproject'
:
self
.
subproject
.
slug
,
})
})
)
)
self
.
assertEqual
s
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
response
=
self
.
client
.
post
(
response
=
self
.
client
.
post
(
reverse
(
'hook-github'
),
reverse
(
'hook-github'
),
{
'payload'
:
GITHUB_PAYLOAD
}
{
'payload'
:
GITHUB_PAYLOAD
}
)
)
self
.
assertEqual
s
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
response
=
self
.
client
.
post
(
response
=
self
.
client
.
post
(
reverse
(
'hook-bitbucket'
),
reverse
(
'hook-bitbucket'
),
{
'payload'
:
BITBUCKET_PAYLOAD_GIT
}
{
'payload'
:
BITBUCKET_PAYLOAD_GIT
}
)
)
self
.
assertEqual
s
(
response
.
status_code
,
405
)
self
.
assertEqual
(
response
.
status_code
,
405
)
def
test_wrong_payload
(
self
):
def
test_wrong_payload
(
self
):
'''
'''
...
...
trans/tests/test_naturaldate.py
View file @
81b9ebb3
...
@@ -64,7 +64,7 @@ class NaturalTimeTest(TestCase):
...
@@ -64,7 +64,7 @@ class NaturalTimeTest(TestCase):
for
diff
,
expected
in
TEST_DATA
:
for
diff
,
expected
in
TEST_DATA
:
testdate
=
now
+
datetime
.
timedelta
(
seconds
=
diff
)
testdate
=
now
+
datetime
.
timedelta
(
seconds
=
diff
)
result
=
naturaltime
(
testdate
,
now
)
result
=
naturaltime
(
testdate
,
now
)
self
.
assertEqual
s
(
self
.
assertEqual
(
expected
,
result
,
expected
,
result
,
'naturaltime(%s) [%s] != "%s"'
%
(
'naturaltime(%s) [%s] != "%s"'
%
(
testdate
,
result
,
expected
,
testdate
,
result
,
expected
,
...
...
trans/tests/test_views.py
View file @
81b9ebb3
...
@@ -142,7 +142,7 @@ class ViewTestCase(RepoTestCase):
...
@@ -142,7 +142,7 @@ class ViewTestCase(RepoTestCase):
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# Try to load PNG with PIL
# Try to load PNG with PIL
image
=
Image
.
open
(
StringIO
(
response
.
content
))
image
=
Image
.
open
(
StringIO
(
response
.
content
))
self
.
assertEqual
s
(
image
.
format
,
'PNG'
)
self
.
assertEqual
(
image
.
format
,
'PNG'
)
def
assertBackend
(
self
,
expected_translated
):
def
assertBackend
(
self
,
expected_translated
):
'''
'''
...
@@ -470,7 +470,7 @@ class EditTest(ViewTestCase):
...
@@ -470,7 +470,7 @@ class EditTest(ViewTestCase):
# Did the commit message got stored?
# Did the commit message got stored?
translation
=
self
.
get_translation
()
translation
=
self
.
get_translation
()
self
.
assertEqual
s
(
self
.
assertEqual
(
'Fixing issue #666'
,
'Fixing issue #666'
,
translation
.
commit_message
translation
.
commit_message
)
)
...
@@ -691,7 +691,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -691,7 +691,7 @@ 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
.
assertEqual
s
(
len
(
self
.
get_unit
().
suggestions
()),
2
)
self
.
assertEqual
(
len
(
self
.
get_unit
().
suggestions
()),
2
)
def
test_delete
(
self
):
def
test_delete
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
translate_url
=
self
.
get_translation
().
get_translate_url
()
...
@@ -701,7 +701,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -701,7 +701,7 @@ class SuggestionsTest(ViewTestCase):
# 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
.
assertEqual
s
(
len
(
suggestions
),
2
)
self
.
assertEqual
(
len
(
suggestions
),
2
)
# Delete one of suggestions
# Delete one of suggestions
response
=
self
.
edit_unit
(
response
=
self
.
edit_unit
(
...
@@ -724,7 +724,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -724,7 +724,7 @@ 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
.
assertEqual
s
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
self
.
assertEqual
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
def
test_accept
(
self
):
def
test_accept
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
translate_url
=
self
.
get_translation
().
get_translate_url
()
...
@@ -734,7 +734,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -734,7 +734,7 @@ class SuggestionsTest(ViewTestCase):
# 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
.
assertEqual
s
(
len
(
suggestions
),
2
)
self
.
assertEqual
(
len
(
suggestions
),
2
)
# Accept one of suggestions
# Accept one of suggestions
response
=
self
.
edit_unit
(
response
=
self
.
edit_unit
(
...
@@ -758,7 +758,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -758,7 +758,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
.
assertEqual
s
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
self
.
assertEqual
(
len
(
self
.
get_unit
().
suggestions
()),
1
)
def
test_accept_anonymous
(
self
):
def
test_accept_anonymous
(
self
):
translate_url
=
self
.
get_translation
().
get_translate_url
()
translate_url
=
self
.
get_translation
().
get_translate_url
()
...
@@ -770,7 +770,7 @@ class SuggestionsTest(ViewTestCase):
...
@@ -770,7 +770,7 @@ class SuggestionsTest(ViewTestCase):
# Get ids of created suggestion
# Get ids of created suggestion
suggestions
=
list
(
self
.
get_unit
().
suggestions
())
suggestions
=
list
(
self
.
get_unit
().
suggestions
())
self
.
assertEqual
s
(
len
(
suggestions
),
1
)
self
.
assertEqual
(
len
(
suggestions
),
1
)
self
.
assertIsNone
(
suggestions
[
0
].
user
)
self
.
assertIsNone
(
suggestions
[
0
].
user
)
...
...
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