Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp
Merge requests
!61
Resolve "Send `location` header on edit?"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Send `location` header on edit?"
138-send-location-header-on-edit
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Ghost User
requested to merge
138-send-location-header-on-edit
into
master
5 years ago
Overview
0
Commits
1
Pipelines
1
Changes
2
Expand
Closes
#138 (closed)
Edited
5 years ago
by
Ghost User
0
0
Merge request reports
Viewing commit
7c8af895
Show latest version
2 files
+
23
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
7c8af895
update: add location header on every 200 responses
· 7c8af895
Jean-Baptiste
authored
5 years ago
djangoldp/tests/tests_update.py
+
20
−
0
Options
from
django.contrib.auth.models
import
User
from
django.test
import
TestCase
from
rest_framework.test
import
APIRequestFactory
,
APIClient
from
rest_framework.utils
import
json
from
djangoldp.serializers
import
LDPSerializer
from
djangoldp.tests.models
import
Post
from
djangoldp.tests.models
import
Skill
,
JobOffer
,
Conversation
,
Message
class
Update
(
TestCase
):
def
setUp
(
self
):
self
.
factory
=
APIRequestFactory
()
self
.
client
=
APIClient
()
def
tearDown
(
self
):
pass
def
test_update
(
self
):
skill
=
Skill
.
objects
.
create
(
title
=
"
to drop
"
,
obligatoire
=
"
obligatoire
"
,
slug
=
"
slug1
"
)
skill1
=
Skill
.
objects
.
create
(
title
=
"
skill1
"
,
obligatoire
=
"
obligatoire
"
,
slug
=
"
slug2
"
)
@@ -250,3 +260,13 @@ class Update(TestCase):
self
.
assertEquals
(
messages
[
0
].
text
,
"
Message 1 UP
"
)
self
.
assertEquals
(
messages
[
1
].
text
,
"
Message 2 UP
"
)
self
.
assertEquals
(
messages
[
2
].
text
,
"
Message 3 NEW
"
)
def
test_put_resource
(
self
):
post
=
Post
.
objects
.
create
(
content
=
"
content
"
)
body
=
[{
'
@id
'
:
'
/posts/{}/
'
.
format
(
post
.
pk
),
'
http://happy-dev.fr/owl/#content
'
:
"
post content
"
}]
response
=
self
.
client
.
put
(
'
/posts/{}/
'
.
format
(
post
.
pk
),
data
=
json
.
dumps
(
body
),
content_type
=
'
application/ld+json
'
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEquals
(
response
.
data
[
'
content
'
],
"
post content
"
)
self
.
assertIn
(
'
location
'
,
response
.
_headers
)
Loading