From 8e824c0bfdc27ed290bd061a4df46ff2d9f16e6b Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Thu, 9 Apr 2020 17:55:29 +0200
Subject: [PATCH] [algorithms][tests][api] Add missing version field to
 concerned tests

---
 beat/web/algorithms/tests/tests_api.py | 29 +++++++++++++++++++-------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/beat/web/algorithms/tests/tests_api.py b/beat/web/algorithms/tests/tests_api.py
index 7c7ada183..3c68aa8f4 100755
--- a/beat/web/algorithms/tests/tests_api.py
+++ b/beat/web/algorithms/tests/tests_api.py
@@ -684,7 +684,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "valid-name1", "description": "blah"}),
+            json.dumps({"name": "valid-name1", "version": 1, "description": "blah"}),
             content_type="application/json",
         )
 
@@ -710,7 +710,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "valid-name1"}),
+            json.dumps({"name": "valid-name1", "version": 1}),
             content_type="application/json",
         )
 
@@ -735,7 +735,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "invalid name1", "description": "blah"}),
+            json.dumps({"name": "invalid name1", "version": 1, "description": "blah"}),
             content_type="application/json",
         )
 
@@ -761,7 +761,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "invalid name1"}),
+            json.dumps({"name": "invalid name1", "version": 1}),
             content_type="application/json",
         )
 
@@ -789,6 +789,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "valid-name1",
+                    "version": 1,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
@@ -824,6 +825,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "valid-name1",
+                    "version": 1,
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
                 }
@@ -857,6 +859,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "invalid name1",
+                    "version": 1,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
@@ -892,6 +895,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "invalid name1",
+                    "version": 1,
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
                 }
@@ -922,7 +926,9 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "usable_by_one_user", "description": "blah"}),
+            json.dumps(
+                {"name": "usable_by_one_user", "version": 1, "description": "blah"}
+            ),
             content_type="application/json",
         )
 
@@ -933,7 +939,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "usable_by_one_user"}),
+            json.dumps({"name": "usable_by_one_user", "version": 1}),
             content_type="application/json",
         )
 
@@ -944,7 +950,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "algorithm 4", "description": "blah"}),
+            json.dumps({"name": "algorithm 4", "version": 1, "description": "blah"}),
             content_type="application/json",
         )
 
@@ -955,7 +961,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
 
         response = self.client.post(
             self.url,
-            json.dumps({"name": "algorithm 4"}),
+            json.dumps({"name": "algorithm 4", "version": 1}),
             content_type="application/json",
         )
 
@@ -969,6 +975,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "usable_by_one_user",
+                    "version": 1,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
@@ -987,6 +994,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "usable_by_one_user",
+                    "version": 1,
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
                 }
@@ -1004,6 +1012,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "algorithm 4",
+                    "version": 1,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
@@ -1022,6 +1031,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "algorithm 4",
+                    "version": 1,
                     "declaration": AlgorithmsAPIBase.DECLARATION,
                     "code": AlgorithmsAPIBase.CODE,
                 }
@@ -1039,6 +1049,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "valid-name1",
+                    "version": 1,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.CXX_DECLARATION,
                 }
@@ -1085,6 +1096,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "valid-name1",
+                    "version": 1,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.CXX_DECLARATION,
                     "fork_of": "jackdoe/binary_personal/1",
@@ -1124,6 +1136,7 @@ class AlgorithmCreation(AlgorithmsAPIBase):
             json.dumps(
                 {
                     "name": "binary_personal",
+                    "version": 2,
                     "description": "blah",
                     "declaration": AlgorithmsAPIBase.CXX_DECLARATION,
                     "previous_version": "jackdoe/binary_personal/1",
-- 
GitLab