Skip to content
Snippets Groups Projects
Commit da340dd2 authored by Jean-Baptiste's avatar Jean-Baptiste
Browse files

Merge branch '137-delete' into 'master'

Resolve "Allow DELETE http requests"

Closes #137

See merge request startinblox/djangoldp-packages/djangoldp!62
parents 58b9097b ca52e7e7
No related branches found
No related tags found
1 merge request!62Resolve "Allow DELETE http requests"
Pipeline #948 passed
......@@ -60,7 +60,8 @@ failures = test_runner.run_tests([
'djangoldp.tests.tests_update',
'djangoldp.tests.tests_auto_author',
# 'djangoldp.tests.tests_temp'
'djangoldp.tests.tests_get'
'djangoldp.tests.tests_get',
'djangoldp.tests.tests_delete'
])
if failures:
sys.exit(failures)
......
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)
......@@ -22,7 +22,8 @@ class JSONLDRenderer(JSONRenderer):
media_type = 'application/ld+json'
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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment