From 8d60dbe41cb65eecbb2006533e87ba2fcf344df3 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste <bleme@pm.me> Date: Thu, 1 Aug 2019 12:06:05 +0200 Subject: [PATCH] add json-ld accepted formats tests --- djangoldp/tests/tests_save.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/djangoldp/tests/tests_save.py b/djangoldp/tests/tests_save.py index c4ca1399..9ee478fc 100644 --- a/djangoldp/tests/tests_save.py +++ b/djangoldp/tests/tests_save.py @@ -237,3 +237,34 @@ class Save(TestCase): content_type='application/ld+json') self.assertEqual(response.status_code, 201) self.assertIn('userprofile', response.data) + + def test_embedded_context(self): + body = { + '@graph': [ + { + '@id': "./", + 'content': "post update", + 'peer_user': "" + } + ], + '@context': { + "@vocab": "http://happy-dev.fr/owl/#", + } + } + response = self.client.post('/posts/', data=json.dumps(body), + content_type='application/ld+json') + self.assertEqual(response.status_code, 201) + + def test_embedded_context_2(self): + body = { + '@id': "./", + 'content': "post update", + 'peer_user': "", + '@context': { + "@vocab": "http://happy-dev.fr/owl/#", + } + } + + response = self.client.post('/posts/', data=json.dumps(body), + content_type='application/ld+json') + self.assertEqual(response.status_code, 201) -- GitLab