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
50ee1cf5
Commit
50ee1cf5
authored
Mar 22, 2016
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add very basic tests for API
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
fe4db295
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
2 deletions
+37
-2
weblate/api/tests.py
weblate/api/tests.py
+37
-2
No files found.
weblate/api/tests.py
View file @
50ee1cf5
...
...
@@ -18,6 +18,41 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from
django.
test
import
TestCa
se
from
django.
core.urlresolvers
import
rever
se
# Create your tests here.
from
rest_framework.test
import
APITestCase
from
weblate.trans.tests.utils
import
get_test_file
,
RepoTestMixin
class
APITest
(
APITestCase
,
RepoTestMixin
):
def
setUp
(
self
):
self
.
clone_test_repos
()
self
.
subproject
=
self
.
create_subproject
()
def
test_list_projects
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'api:project-list'
)
)
self
.
assertEqual
(
len
(
response
.
data
),
1
)
self
.
assertEqual
(
response
.
data
[
0
][
'slug'
],
'test'
)
def
test_list_components
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'api:subproject-list'
)
)
self
.
assertEqual
(
len
(
response
.
data
),
1
)
self
.
assertEqual
(
response
.
data
[
0
][
'slug'
],
'test'
)
self
.
assertEqual
(
response
.
data
[
0
][
'project'
],
1
)
def
test_list_translations
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'api:translation-list'
)
)
self
.
assertEqual
(
len
(
response
.
data
),
3
)
def
test_list_languages
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'api:language-list'
)
)
self
.
assertEqual
(
len
(
response
.
data
),
3
)
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