From 6e0bdda1d37d57ceca65f264d70385cf86110351 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Wed, 22 Apr 2020 11:37:58 +0200
Subject: [PATCH] [dataformats][tests] Update tests for new put implementation

---
 beat/web/dataformats/tests/tests_api.py | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/beat/web/dataformats/tests/tests_api.py b/beat/web/dataformats/tests/tests_api.py
index da8f13691..56f639975 100644
--- a/beat/web/dataformats/tests/tests_api.py
+++ b/beat/web/dataformats/tests/tests_api.py
@@ -521,7 +521,8 @@ class DataFormatUpdate(DataFormatsAPIBase):
         self.login_jackdoe()
         url = reverse("api_dataformats:object", args=["jackdoe", "format2", 1])
         response = self.client.put(url)
-        self.checkResponse(response, 400)
+
+        self.checkResponse(response, 200, content_type="application/json")
 
     def test_fail_to_update_a_shared_dataformat(self):
         self.login_johndoe()
@@ -545,7 +546,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format_private"
@@ -567,7 +568,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(author__username="johndoe", name="format1")
         self.assertEqual(dataformat.description, b"blah")
@@ -581,7 +582,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format_private"
@@ -612,7 +613,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format_private", version=1
@@ -646,7 +647,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format4", version=1
@@ -674,7 +675,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format4", version=1
@@ -703,7 +704,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format_private", version=1
@@ -740,7 +741,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format4", version=1
@@ -768,7 +769,7 @@ class DataFormatUpdate(DataFormatsAPIBase):
             content_type="application/json",
         )
 
-        self.checkResponse(response, 204)
+        self.checkResponse(response, 200, content_type="application/json")
 
         dataformat = DataFormat.objects.get(
             author__username="johndoe", name="format4", version=1
-- 
GitLab