Browse Source

add tests for set wrong status of content

Guénaël Muller 6 years ago
parent
commit
c6b37c546a
1 changed files with 41 additions and 0 deletions
  1. 41 0
      tracim/tests/functional/test_contents.py

+ 41 - 0
tracim/tests/functional/test_contents.py View File

@@ -408,6 +408,26 @@ class TestHtmlDocuments(FunctionalTest):
408 408
         assert content['content_id'] == 6
409 409
         assert content['status'] == 'closed-deprecated'
410 410
 
411
+    def test_api__set_html_document_status__err_400__wrong_status(self) -> None:
412
+        """
413
+        Get one html document of a content
414
+        """
415
+        self.testapp.authorization = (
416
+            'Basic',
417
+            (
418
+                'admin@admin.admin',
419
+                'admin@admin.admin'
420
+            )
421
+        )
422
+        params = {
423
+            'status': 'unexistant-status',
424
+        }
425
+        res = self.testapp.put_json(
426
+            '/api/v2/workspaces/2/html-documents/6/status',
427
+            params=params,
428
+            status=400
429
+        )
430
+
411 431
 
412 432
 class TestThreads(FunctionalTest):
413 433
     """
@@ -746,3 +766,24 @@ class TestThreads(FunctionalTest):
746 766
         assert content['content_type'] == 'thread'
747 767
         assert content['content_id'] == 7
748 768
         assert content['status'] == 'closed-deprecated'
769
+
770
+    def test_api__set_thread_status__ok_400__wrong_status(self) -> None:
771
+        """
772
+        Set thread status
773
+        """
774
+        self.testapp.authorization = (
775
+            'Basic',
776
+            (
777
+                'admin@admin.admin',
778
+                'admin@admin.admin'
779
+            )
780
+        )
781
+        params = {
782
+            'status': 'unexistant-status',
783
+        }
784
+
785
+        res = self.testapp.put_json(
786
+            '/api/v2/workspaces/2/threads/7/status',
787
+            params=params,
788
+            status=400
789
+        )