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
14be1b89
Commit
14be1b89
authored
May 14, 2015
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
3aabde32
b7e2e62f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
52 additions
and
28 deletions
+52
-28
weblate/accounts/tests.py
weblate/accounts/tests.py
+1
-1
weblate/lang/tests.py
weblate/lang/tests.py
+1
-1
weblate/trans/models/unit.py
weblate/trans/models/unit.py
+15
-12
weblate/trans/tests/test_acl.py
weblate/trans/tests/test_acl.py
+1
-1
weblate/trans/tests/test_charts.py
weblate/trans/tests/test_charts.py
+1
-1
weblate/trans/tests/test_models.py
weblate/trans/tests/test_models.py
+28
-7
weblate/trans/tests/test_vcs.py
weblate/trans/tests/test_vcs.py
+1
-1
weblate/trans/tests/test_views.py
weblate/trans/tests/test_views.py
+4
-4
No files found.
weblate/accounts/tests.py
View file @
14be1b89
...
...
@@ -219,7 +219,7 @@ class RegistrationTest(TestCase, RegistrationTestMixin):
# Check database models
user
=
User
.
objects
.
get
(
username
=
'username'
)
self
.
assertEqual
s
(
self
.
assertEqual
(
VerifiedEmail
.
objects
.
filter
(
social__user
=
user
).
count
(),
2
)
self
.
assertTrue
(
...
...
weblate/lang/tests.py
View file @
14be1b89
...
...
@@ -261,7 +261,7 @@ class VerifyPluralsTest(TestCase):
# Get maximal plural
nplurals
=
max
([
plural
(
x
)
for
x
in
range
(
200
)])
+
1
# Check it matches ours
self
.
assertEqual
s
(
self
.
assertEqual
(
nplurals
,
language
.
nplurals
,
'Invalid nplurals for {0}: {1} ({2}, {3})'
.
format
(
...
...
weblate/trans/models/unit.py
View file @
14be1b89
...
...
@@ -262,20 +262,23 @@ class UnitManager(models.Manager):
"""
Finds closely similar units.
"""
queue
=
multiprocessing
.
Queue
()
proc
=
multiprocessing
.
Process
(
target
=
more_like_queue
,
args
=
(
unit
.
checksum
,
unit
.
source
,
top
,
queue
)
)
proc
.
start
()
proc
.
join
(
appsettings
.
MT_WEBLATE_LIMIT
)
if
proc
.
is_alive
():
proc
.
terminate
()
if
appsettings
.
MT_WEBLATE_LIMIT
>=
0
:
queue
=
multiprocessing
.
Queue
()
proc
=
multiprocessing
.
Process
(
target
=
more_like_queue
,
args
=
(
unit
.
checksum
,
unit
.
source
,
top
,
queue
)
)
proc
.
start
()
proc
.
join
(
appsettings
.
MT_WEBLATE_LIMIT
)
if
proc
.
is_alive
():
proc
.
terminate
()
if
queue
.
empty
():
raise
Exception
(
'Request timed out.'
)
if
queue
.
empty
():
raise
Exception
(
'Request timed out.'
)
more_results
=
queue
.
get
()
more_results
=
queue
.
get
()
else
:
more_results
=
more_like
(
unit
.
checksum
,
unit
.
source
,
top
)
same_results
=
fulltext_search
(
unit
.
get_source_plurals
()[
0
],
...
...
weblate/trans/tests/test_acl.py
View file @
14be1b89
...
...
@@ -45,7 +45,7 @@ class ACLViewTest(ViewTestCase):
response
=
self
.
client
.
get
(
reverse
(
'project'
,
kwargs
=
self
.
kw_project
)
)
self
.
assertEqual
s
(
response
.
status_code
,
403
)
self
.
assertEqual
(
response
.
status_code
,
403
)
def
test_acl
(
self
):
"""Regular user should not have access to user management.
...
...
weblate/trans/tests/test_charts.py
View file @
14be1b89
...
...
@@ -35,7 +35,7 @@ class ChartsTest(ViewTestCase):
"""
Tests whether response has valid json chart data.
"""
self
.
assertEqual
s
(
response
.
get
(
'Content-Type'
),
'application/json'
)
self
.
assertEqual
(
response
.
get
(
'Content-Type'
),
'application/json'
)
data
=
json
.
loads
(
response
.
content
)
self
.
assertTrue
(
'series'
in
data
)
self
.
assertTrue
(
'labels'
in
data
)
...
...
weblate/trans/tests/test_models.py
View file @
14be1b89
...
...
@@ -745,14 +745,16 @@ class WhiteboardMessageTest(TestCase):
WhiteboardMessage
()
class
SourceTest
(
RepoTestCase
):
"""
Source objects testing.
"""
class
ModelTestCase
(
RepoTestCase
):
def
setUp
(
self
):
super
(
SourceTest
,
self
).
setUp
()
super
(
ModelTestCase
,
self
).
setUp
()
self
.
create_subproject
()
class
SourceTest
(
ModelTestCase
):
"""
Source objects testing.
"""
def
test_exists
(
self
):
self
.
assertTrue
(
Source
.
objects
.
exists
())
...
...
@@ -773,10 +775,29 @@ class SourceTest(RepoTestCase):
"""
Setting of Source check_flags changes checks for related units.
"""
self
.
assertEqual
s
(
Check
.
objects
.
count
(),
1
)
self
.
assertEqual
(
Check
.
objects
.
count
(),
1
)
check
=
Check
.
objects
.
all
()[
0
]
unit
=
get_related_units
(
check
)[
0
]
source
=
unit
.
source_info
source
.
check_flags
=
'ignore-{0}'
.
format
(
check
.
check
)
source
.
save
()
self
.
assertEquals
(
Check
.
objects
.
count
(),
0
)
self
.
assertEqual
(
Check
.
objects
.
count
(),
0
)
class
UnitTest
(
ModelTestCase
):
@
OverrideSettings
(
MT_WEBLATE_LIMIT
=
15
)
def
test_more_like
(
self
):
unit
=
Unit
.
objects
.
all
()[
0
]
self
.
assertEqual
(
Unit
.
objects
.
more_like_this
(
unit
).
count
(),
0
)
@
OverrideSettings
(
MT_WEBLATE_LIMIT
=
0
)
def
test_more_like_timeout
(
self
):
unit
=
Unit
.
objects
.
all
()[
0
]
self
.
assertRaisesMessage
(
Exception
,
'Request timed out.'
,
Unit
.
objects
.
more_like_this
,
unit
)
@
OverrideSettings
(
MT_WEBLATE_LIMIT
=-
1
)
def
test_more_like_no_fork
(
self
):
unit
=
Unit
.
objects
.
all
()[
0
]
self
.
assertEqual
(
Unit
.
objects
.
more_like_this
(
unit
).
count
(),
0
)
weblate/trans/tests/test_vcs.py
View file @
14be1b89
...
...
@@ -208,7 +208,7 @@ class VCSGitTest(RepoTestCase):
[
'testfile'
]
)
# Check we have new revision
self
.
assertNotEqual
s
(
self
.
assertNotEqual
(
oldrev
,
self
.
repo
.
last_revision
)
...
...
weblate/trans/tests/test_views.py
View file @
14be1b89
...
...
@@ -188,7 +188,7 @@ class ViewTestCase(RepoTestCase):
# Check response status code
self
.
assertEqual
(
response
.
status_code
,
200
)
dom
=
minidom
.
parseString
(
response
.
content
)
self
.
assertEqual
s
(
dom
.
firstChild
.
nodeName
,
'svg'
)
self
.
assertEqual
(
dom
.
firstChild
.
nodeName
,
'svg'
)
def
assertBackend
(
self
,
expected_translated
):
'''
...
...
@@ -907,8 +907,8 @@ class SourceStringsTest(ViewTestCase):
self
.
assertRedirects
(
response
,
source
.
get_absolute_url
())
unit
=
self
.
get_unit
()
self
.
assertEqual
s
(
unit
.
priority
,
60
)
self
.
assertEqual
s
(
unit
.
source_info
.
priority
,
60
)
self
.
assertEqual
(
unit
.
priority
,
60
)
self
.
assertEqual
(
unit
.
source_info
.
priority
,
60
)
def
test_edit_check_flags
(
self
):
# Need extra power
...
...
@@ -923,7 +923,7 @@ class SourceStringsTest(ViewTestCase):
self
.
assertRedirects
(
response
,
source
.
get_absolute_url
())
unit
=
self
.
get_unit
()
self
.
assertEqual
s
(
unit
.
source_info
.
check_flags
,
'ignore-same'
)
self
.
assertEqual
(
unit
.
source_info
.
check_flags
,
'ignore-same'
)
def
test_review_source
(
self
):
response
=
self
.
client
.
get
(
...
...
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