From 3a9334f38095a73e27b4f1ba5fa008430e6387eb Mon Sep 17 00:00:00 2001 From: Jean-Baptiste <bleme@pm.me> Date: Mon, 18 Feb 2019 15:44:08 +0100 Subject: [PATCH] update: No bug here. Fix the test to make it pass with the right input --- djangoldp/tests/runner.py | 2 +- djangoldp/tests/tests_update.py | 16 ++++++++++++---- djangoldp/tests/urls.py | 3 +++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/djangoldp/tests/runner.py b/djangoldp/tests/runner.py index 955d313d..1cf8604d 100644 --- a/djangoldp/tests/runner.py +++ b/djangoldp/tests/runner.py @@ -25,7 +25,7 @@ from django.test.runner import DiscoverRunner test_runner = DiscoverRunner(verbosity=1) failures = test_runner.run_tests([ - #'djangoldp.tests.tests_save', + 'djangoldp.tests.tests_save', 'djangoldp.tests.tests_update']) if failures: sys.exit(failures) diff --git a/djangoldp/tests/tests_update.py b/djangoldp/tests/tests_update.py index b01f646c..7b232b44 100644 --- a/djangoldp/tests/tests_update.py +++ b/djangoldp/tests/tests_update.py @@ -195,21 +195,29 @@ class Serializer(TestCase): { "@id": "https://happy-dev.fr/messages/{}/".format(message1.pk), "text": "Message 1 UP", - "author_user_id": user1.pk, + "author_user": { + '@id': "https://happy-dev.fr/users/{}/".format(user1.pk) + } }, { "@id": "https://happy-dev.fr/messages/{}/".format(message2.pk), "text": "Message 2 UP", - "author_user_id": user1.pk, + "author_user": { + '@id': "https://happy-dev.fr/users/{}/".format(user1.pk) + } }, { "@id": "_:b1", "text": "Message 3 NEW", - "author_user_id": user1.pk, + "author_user": { + '@id': "https://happy-dev.fr/users/{}/".format(user1.pk) + } }, { '@id': "https://happy-dev.fr/threads/{}".format(thread.pk), - "author_user_id": user1.pk, + "author_user": { + '@id': "https://happy-dev.fr/users/{}/".format(user1.pk) + }, 'description': "Thread 1 UP", 'message_set': { "@id": "https://happy-dev.fr/threads/{}/message_set".format(thread.pk) diff --git a/djangoldp/tests/urls.py b/djangoldp/tests/urls.py index eeb96677..0066129b 100644 --- a/djangoldp/tests/urls.py +++ b/djangoldp/tests/urls.py @@ -1,3 +1,5 @@ +from django.conf import settings + from djangoldp.tests.models import Skill, JobOffer, Message, Thread from djangoldp.views import LDPViewSet from django.conf.urls import url @@ -8,4 +10,5 @@ urlpatterns = [ url(r'^job-offers/', LDPViewSet.urls(model=JobOffer, nested_fields=["skills"], permission_classes=())), url(r'^messages/', LDPViewSet.urls(model=Message, permission_classes=[], fields=["@id", "text"], nested_fields=[])), url(r'^threads/', LDPViewSet.urls(model=Thread, nested_fields=["message_set"], permission_classes=())), + url(r'^users/', LDPViewSet.urls(model=settings.AUTH_USER_MODEL, permission_classes=[])), ] \ No newline at end of file -- GitLab