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
8a1c5899
Commit
8a1c5899
authored
May 13, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for Check model
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
07aaf076
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
0 deletions
+60
-0
weblate/trans/tests/test_unitdata.py
weblate/trans/tests/test_unitdata.py
+60
-0
No files found.
weblate/trans/tests/test_unitdata.py
0 → 100644
View file @
8a1c5899
# -*- coding: utf-8 -*-
#
# Copyright © 2012 - 2015 Michal Čihař <michal@cihar.com>
#
# This file is part of Weblate <http://weblate.org/>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Tests for unitdata models.
"""
from
django.test
import
TestCase
from
weblate.lang.models
import
Language
from
weblate.trans.models
import
Check
,
Project
class
UnitdataTestCase
(
TestCase
):
def
setUp
(
self
):
super
(
UnitdataTestCase
,
self
).
setUp
()
self
.
project
=
Project
.
objects
.
create
(
name
=
'test'
)
def
create_check
(
self
,
name
):
language
=
Language
.
objects
.
get
(
code
=
'ach'
)
return
Check
.
objects
.
create
(
project
=
self
.
project
,
language
=
language
,
check
=
name
,
contentsum
=
'123456'
)
def
test_check
(
self
):
check
=
self
.
create_check
(
'same'
)
self
.
assertEqual
(
unicode
(
check
.
get_description
()),
u'Source and translated strings are same'
)
self
.
assertEqual
(
check
.
get_severity
(),
'warning'
)
self
.
assertTrue
(
check
.
get_doc_url
().
endswith
(
'user/checks.html#check-same'
)
)
self
.
assertEqual
(
unicode
(
check
),
u'test/Acholi: same'
)
def
test_check_nonexisting
(
self
):
check
=
self
.
create_check
(
'-invalid-'
)
self
.
assertEqual
(
check
.
get_description
(),
'-invalid-'
)
self
.
assertEqual
(
check
.
get_severity
(),
'info'
)
self
.
assertEqual
(
check
.
get_doc_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