Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
b14ad659
Commit
b14ad659
authored
4 years ago
by
Eva Bardou
Browse files
Options
Downloads
Patches
Plain Diff
Add tests for the new endpoint
parent
0ed3c267
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
arkindex/dataimport/tests/test_workers_api.py
+20
-0
20 additions, 0 deletions
arkindex/dataimport/tests/test_workers_api.py
with
20 additions
and
0 deletions
arkindex/dataimport/tests/test_workers_api.py
+
20
−
0
View file @
b14ad659
...
...
@@ -220,3 +220,23 @@ class TestWorkersWorkerVersions(FixtureAPITestCase):
'
revision
'
:
[
'
This field is required.
'
],
'
configuration
'
:
[
'
This field is required.
'
]
})
def
test_retrieve_version_requires_login
(
self
):
response
=
self
.
client
.
get
(
reverse
(
'
api:version-retrieve
'
,
kwargs
=
{
'
pk
'
:
str
(
self
.
version_1
.
id
)}))
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_403_FORBIDDEN
)
def
test_retrieve_version_invalid_id
(
self
):
self
.
client
.
force_login
(
self
.
user
)
response
=
self
.
client
.
get
(
reverse
(
'
api:version-retrieve
'
,
kwargs
=
{
'
pk
'
:
'
12341234-1234-1234-1234-123412341234
'
})
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_404_NOT_FOUND
)
def
test_retrieve_version
(
self
):
self
.
client
.
force_login
(
self
.
user
)
response
=
self
.
client
.
get
(
reverse
(
'
api:version-retrieve
'
,
kwargs
=
{
'
pk
'
:
str
(
self
.
version_1
.
id
)}))
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
data
=
response
.
json
()
self
.
assertEqual
(
data
[
'
id
'
],
str
(
self
.
version_1
.
id
))
self
.
assertEqual
(
data
[
'
configuration
'
],
{
"
test
"
:
"
test1
"
})
self
.
assertEqual
(
data
[
'
revision
'
][
'
id
'
],
str
(
self
.
rev
.
id
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment