Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
99
Issue boards
Milestones
Wiki
Code
Merge requests
5
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
Commits
ca52e7e7
Commit
ca52e7e7
authored
5 years ago
by
Jean-Baptiste
Browse files
Options
Downloads
Patches
Plain Diff
fix: error 500 on DELETE
parent
58b9097b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!62
Resolve "Allow DELETE http requests"
Pipeline
#944
passed with stage
in 1 minute and 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
djangoldp/tests/runner.py
+2
-1
2 additions, 1 deletion
djangoldp/tests/runner.py
djangoldp/tests/tests_delete.py
+21
-0
21 additions, 0 deletions
djangoldp/tests/tests_delete.py
djangoldp/views.py
+2
-1
2 additions, 1 deletion
djangoldp/views.py
with
25 additions
and
2 deletions
djangoldp/tests/runner.py
+
2
−
1
View file @
ca52e7e7
...
@@ -60,7 +60,8 @@ failures = test_runner.run_tests([
...
@@ -60,7 +60,8 @@ failures = test_runner.run_tests([
'
djangoldp.tests.tests_update
'
,
'
djangoldp.tests.tests_update
'
,
'
djangoldp.tests.tests_auto_author
'
,
'
djangoldp.tests.tests_auto_author
'
,
# 'djangoldp.tests.tests_temp'
# 'djangoldp.tests.tests_temp'
'
djangoldp.tests.tests_get
'
'
djangoldp.tests.tests_get
'
,
'
djangoldp.tests.tests_delete
'
])
])
if
failures
:
if
failures
:
sys
.
exit
(
failures
)
sys
.
exit
(
failures
)
...
...
This diff is collapsed.
Click to expand it.
djangoldp/tests/tests_delete.py
0 → 100644
+
21
−
0
View file @
ca52e7e7
from
django.test
import
TestCase
from
rest_framework.test
import
APIRequestFactory
,
APIClient
from
djangoldp.tests.models
import
Post
class
TestDelete
(
TestCase
):
def
setUp
(
self
):
self
.
factory
=
APIRequestFactory
()
self
.
client
=
APIClient
()
def
tearDown
(
self
):
pass
def
test_delete
(
self
):
post
=
Post
.
objects
.
create
(
content
=
"
content
"
)
response
=
self
.
client
.
delete
(
'
/posts/{}/
'
.
format
(
post
.
pk
),
content_type
=
'
application/ld+json
'
)
self
.
assertEqual
(
response
.
status_code
,
204
)
self
.
assertEqual
(
Post
.
objects
.
filter
(
pk
=
post
.
pk
).
count
(),
0
)
This diff is collapsed.
Click to expand it.
djangoldp/views.py
+
2
−
1
View file @
ca52e7e7
...
@@ -22,7 +22,8 @@ class JSONLDRenderer(JSONRenderer):
...
@@ -22,7 +22,8 @@ class JSONLDRenderer(JSONRenderer):
media_type
=
'
application/ld+json
'
media_type
=
'
application/ld+json
'
def
render
(
self
,
data
,
accepted_media_type
=
None
,
renderer_context
=
None
):
def
render
(
self
,
data
,
accepted_media_type
=
None
,
renderer_context
=
None
):
data
[
"
@context
"
]
=
settings
.
LDP_RDF_CONTEXT
if
data
is
not
None
:
data
[
"
@context
"
]
=
settings
.
LDP_RDF_CONTEXT
return
super
(
JSONLDRenderer
,
self
).
render
(
data
,
accepted_media_type
,
renderer_context
)
return
super
(
JSONLDRenderer
,
self
).
render
(
data
,
accepted_media_type
,
renderer_context
)
...
...
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