diff --git a/beat/web/algorithms/tests/tests_api.py b/beat/web/algorithms/tests/tests_api.py index 3c68aa8f43bb226cd06b5f0385f417d77ef4d926..58b92349dfcf9c2fca9953e7bddce89fbf388cf8 100755 --- a/beat/web/algorithms/tests/tests_api.py +++ b/beat/web/algorithms/tests/tests_api.py @@ -1925,33 +1925,33 @@ class AlgorithmBinaryUpdate(AlgorithmsAPIBase): class AlgorithmRetrieval(AlgorithmsAPIBase): def test_no_retrieval_of_confidential_algorithm_for_anonymous_user(self): - url = reverse("api_algorithms:object", args=["johndoe", "forked_algo"]) + url = reverse("api_algorithms:object", args=["johndoe", "forked_algo", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_username(self): self.login_johndoe() - url = reverse("api_algorithms:object", args=["unknown", "forked_algo"]) + url = reverse("api_algorithms:object", args=["unknown", "forked_algo", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_algorithm_name(self): self.login_johndoe() - url = reverse("api_algorithms:object", args=["johndoe", "unknown"]) + url = reverse("api_algorithms:object", args=["johndoe", "unknown", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_no_retrieval_of_confidential_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:object", args=["johndoe", "forked_algo"]) + url = reverse("api_algorithms:object", args=["johndoe", "forked_algo", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_successful_retrieval_of_public_algorithm_for_anonymous_user(self): - url = reverse("api_algorithms:object", args=["jackdoe", "public_for_all"]) + url = reverse("api_algorithms:object", args=["jackdoe", "public_for_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1965,7 +1965,7 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): self.assertEqual(data["code"].encode("utf-8"), AlgorithmsAPIBase.CODE) def test_successful_retrieval_of_usable_algorithm_for_anonymous_user(self): - url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_all"]) + url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1979,7 +1979,7 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_public_algorithm(self): self.login_johndoe() - url = reverse("api_algorithms:object", args=["jackdoe", "public_for_all"]) + url = reverse("api_algorithms:object", args=["jackdoe", "public_for_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1995,7 +1995,9 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_usable_algorithm(self): self.login_johndoe() - url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_one_user"]) + url = reverse( + "api_algorithms:object", args=["jackdoe", "usable_by_one_user", 1] + ) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2009,7 +2011,7 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_publicly_usable_algorithm(self): self.login_johndoe() - url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_all"]) + url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2023,7 +2025,9 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_confidential_algorithm(self): self.login_johndoe() - url = reverse("api_algorithms:object", args=["jackdoe", "public_for_one_user"]) + url = reverse( + "api_algorithms:object", args=["jackdoe", "public_for_one_user", 1] + ) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2039,7 +2043,7 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_own_public_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:object", args=["jackdoe", "public_for_all"]) + url = reverse("api_algorithms:object", args=["jackdoe", "public_for_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2060,7 +2064,9 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_own_confidential_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_one_user"]) + url = reverse( + "api_algorithms:object", args=["jackdoe", "usable_by_one_user", 1] + ) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2081,7 +2087,7 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_own_usable_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_all"]) + url = reverse("api_algorithms:object", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2102,7 +2108,9 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_own_shared_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:object", args=["jackdoe", "public_for_one_user"]) + url = reverse( + "api_algorithms:object", args=["jackdoe", "public_for_one_user", 1] + ) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2123,7 +2131,7 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_binary_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:object", args=["jackdoe", "binary_personal"]) + url = reverse("api_algorithms:object", args=["jackdoe", "binary_personal", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -2139,34 +2147,34 @@ class AlgorithmRetrieval(AlgorithmsAPIBase): class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): def test_no_retrieval_of_confidential_algorithm_for_anonymous_user(self): - url = reverse("api_algorithms:binary", args=["jackdoe", "binary_personal"]) + url = reverse("api_algorithms:binary", args=["jackdoe", "binary_personal", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_username(self): self.login_johndoe() - url = reverse("api_algorithms:binary", args=["unknown", "binary_personal"]) + url = reverse("api_algorithms:binary", args=["unknown", "binary_personal", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_algorithm_name(self): self.login_johndoe() - url = reverse("api_algorithms:binary", args=["johndoe", "unknown"]) + url = reverse("api_algorithms:binary", args=["johndoe", "unknown", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_no_retrieval_of_confidential_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:binary", args=["johndoe", "binary_personal"]) + url = reverse("api_algorithms:binary", args=["johndoe", "binary_personal", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_successful_retrieval_of_public_algorithm_for_anonymous_user(self): url = reverse( - "api_algorithms:binary", args=["jackdoe", "binary_public_for_all"] + "api_algorithms:binary", args=["jackdoe", "binary_public_for_all", 1] ) response = self.client.get(url) data = self.checkResponse( @@ -2176,7 +2184,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): self.assertEqual(data, AlgorithmsAPIBase.BINARY) def test_no_retrieval_of_usable_algorithm_for_anonymous_user(self): - url = reverse("api_algorithms:binary", args=["jackdoe", "usable_by_all"]) + url = reverse("api_algorithms:binary", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) self.checkResponse(response, 404) @@ -2184,7 +2192,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): self.login_johndoe() url = reverse( - "api_algorithms:binary", args=["jackdoe", "binary_public_for_all"] + "api_algorithms:binary", args=["jackdoe", "binary_public_for_all", 1] ) response = self.client.get(url) data = self.checkResponse( @@ -2197,7 +2205,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): self.login_johndoe() url = reverse( - "api_algorithms:binary", args=["jackdoe", "binary_usable_by_one_user"] + "api_algorithms:binary", args=["jackdoe", "binary_usable_by_one_user", 1] ) response = self.client.get(url) self.checkResponse(response, 404) @@ -2205,7 +2213,9 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): def test_no_retrieval_of_publicly_usable_algorithm(self): self.login_johndoe() - url = reverse("api_algorithms:binary", args=["jackdoe", "binary_usable_by_all"]) + url = reverse( + "api_algorithms:binary", args=["jackdoe", "binary_usable_by_all", 1] + ) response = self.client.get(url) self.checkResponse(response, 404) @@ -2213,7 +2223,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): self.login_johndoe() url = reverse( - "api_algorithms:binary", args=["jackdoe", "binary_public_for_one_user"] + "api_algorithms:binary", args=["jackdoe", "binary_public_for_one_user", 1] ) response = self.client.get(url) data = self.checkResponse( @@ -2226,7 +2236,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): self.login_jackdoe() url = reverse( - "api_algorithms:binary", args=["jackdoe", "binary_public_for_all"] + "api_algorithms:binary", args=["jackdoe", "binary_public_for_all", 1] ) response = self.client.get(url) data = self.checkResponse( @@ -2238,7 +2248,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_own_confidential_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:binary", args=["jackdoe", "binary_personal"]) + url = reverse("api_algorithms:binary", args=["jackdoe", "binary_personal", 1]) response = self.client.get(url) data = self.checkResponse( response, 200, content_type="application/octet-stream" @@ -2249,7 +2259,9 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): def test_successful_retrieval_of_own_usable_algorithm(self): self.login_jackdoe() - url = reverse("api_algorithms:binary", args=["jackdoe", "binary_usable_by_all"]) + url = reverse( + "api_algorithms:binary", args=["jackdoe", "binary_usable_by_all", 1] + ) response = self.client.get(url) data = self.checkResponse( response, 200, content_type="application/octet-stream" @@ -2261,7 +2273,7 @@ class AlgorithmBinaryRetrieval(AlgorithmsAPIBase): self.login_jackdoe() url = reverse( - "api_algorithms:binary", args=["jackdoe", "binary_public_for_one_user"] + "api_algorithms:binary", args=["jackdoe", "binary_public_for_one_user", 1] ) response = self.client.get(url) data = self.checkResponse( diff --git a/beat/web/dataformats/tests/tests_api.py b/beat/web/dataformats/tests/tests_api.py index d2bfe80998800c1f03478fcea7b591314d75aa05..da8f136914ba0e88b14d514ed6b2f40c22b2d8cd 100644 --- a/beat/web/dataformats/tests/tests_api.py +++ b/beat/web/dataformats/tests/tests_api.py @@ -519,7 +519,7 @@ class DataFormatUpdate(DataFormatsAPIBase): def test_no_update_without_content(self): self.login_jackdoe() - url = reverse("api_dataformats:object", args=["jackdoe", "format2"]) + url = reverse("api_dataformats:object", args=["jackdoe", "format2", 1]) response = self.client.put(url) self.checkResponse(response, 400) diff --git a/beat/web/libraries/tests/tests_api.py b/beat/web/libraries/tests/tests_api.py index 7b6e62b4de4ee501e50285169c9505d9e51ac6df..2108a8c81d46a8d96954b1b23c12a054c5cbf778 100644 --- a/beat/web/libraries/tests/tests_api.py +++ b/beat/web/libraries/tests/tests_api.py @@ -895,32 +895,32 @@ class LibraryUpdate(LibrariesAPIBase): class LibraryRetrieval(LibrariesAPIBase): def test_no_retrieval_of_confidential_library_for_anonymous_user(self): - url = reverse("api_libraries:object", args=["johndoe", "forked_algo"]) + url = reverse("api_libraries:object", args=["johndoe", "forked_algo", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_username(self): self.login_johndoe() - url = reverse("api_libraries:object", args=["unknown", "forked_algo"]) + url = reverse("api_libraries:object", args=["unknown", "forked_algo", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_library_name(self): self.login_johndoe() - url = reverse("api_libraries:object", args=["johndoe", "unknown"]) + url = reverse("api_libraries:object", args=["johndoe", "unknown", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_no_retrieval_of_confidential_library(self): self.login_jackdoe() - url = reverse("api_libraries:object", args=["johndoe", "forked_algo"]) + url = reverse("api_libraries:object", args=["johndoe", "forked_algo", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_successful_retrieval_of_public_library_for_anonymous_user(self): - url = reverse("api_libraries:object", args=["jackdoe", "public_for_all"]) + url = reverse("api_libraries:object", args=["jackdoe", "public_for_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -933,7 +933,7 @@ class LibraryRetrieval(LibrariesAPIBase): self.assertEqual(data["code"].encode("utf-8"), LibrariesAPIBase.CODE) def test_successful_retrieval_of_usable_library_for_anonymous_user(self): - url = reverse("api_libraries:object", args=["jackdoe", "usable_by_all"]) + url = reverse("api_libraries:object", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -946,7 +946,7 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_public_library(self): self.login_johndoe() - url = reverse("api_libraries:object", args=["jackdoe", "public_for_all"]) + url = reverse("api_libraries:object", args=["jackdoe", "public_for_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -961,7 +961,7 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_usable_library(self): self.login_johndoe() - url = reverse("api_libraries:object", args=["jackdoe", "usable_by_one_user"]) + url = reverse("api_libraries:object", args=["jackdoe", "usable_by_one_user", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -974,7 +974,7 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_publicly_usable_library(self): self.login_johndoe() - url = reverse("api_libraries:object", args=["jackdoe", "usable_by_all"]) + url = reverse("api_libraries:object", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -987,7 +987,9 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_confidential_library(self): self.login_johndoe() - url = reverse("api_libraries:object", args=["jackdoe", "public_for_one_user"]) + url = reverse( + "api_libraries:object", args=["jackdoe", "public_for_one_user", 1] + ) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1002,7 +1004,7 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_own_public_library(self): self.login_jackdoe() - url = reverse("api_libraries:object", args=["jackdoe", "public_for_all"]) + url = reverse("api_libraries:object", args=["jackdoe", "public_for_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1022,7 +1024,7 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_own_confidential_library(self): self.login_jackdoe() - url = reverse("api_libraries:object", args=["jackdoe", "usable_by_one_user"]) + url = reverse("api_libraries:object", args=["jackdoe", "usable_by_one_user", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1042,7 +1044,7 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_own_usable_library(self): self.login_jackdoe() - url = reverse("api_libraries:object", args=["jackdoe", "usable_by_all"]) + url = reverse("api_libraries:object", args=["jackdoe", "usable_by_all", 1]) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") @@ -1062,7 +1064,9 @@ class LibraryRetrieval(LibrariesAPIBase): def test_successful_retrieval_of_own_shared_library(self): self.login_jackdoe() - url = reverse("api_libraries:object", args=["jackdoe", "public_for_one_user"]) + url = reverse( + "api_libraries:object", args=["jackdoe", "public_for_one_user", 1] + ) response = self.client.get(url) data = self.checkResponse(response, 200, content_type="application/json") diff --git a/beat/web/toolchains/tests.py b/beat/web/toolchains/tests.py index c3c6e11cd38caaddbe09a2cc08a7ede5bd4cdd7e..eba00d7809ade16dd93340a35ac33b0bf0bf7fb8 100644 --- a/beat/web/toolchains/tests.py +++ b/beat/web/toolchains/tests.py @@ -1193,16 +1193,6 @@ class ToolchainUpdate(ToolchainsAPIBase): self.checkResponse(response, 404) - def test_fail_to_update_without_version_number(self): - self.login_jackdoe() - - url = reverse("api_toolchains:object", args=["jackdoe", "personal"]) - response = self.client.put( - url, json.dumps({"description": "blah"}), content_type="application/json" - ) - - self.checkResponse(response, 400) - def test_fail_to_update_without_content_not_json_request(self): self.login_jackdoe() response = self.client.put(self.url) @@ -1323,14 +1313,14 @@ class ToolchainRetrieval(ToolchainsAPIBase): def test_fail_to_retrieve_with_invalid_username(self): self.login_jackdoe() - url = reverse("api_toolchains:object", args=["unknown", "personal"]) + url = reverse("api_toolchains:object", args=["unknown", "personal", 1]) response = self.client.get(url) self.checkResponse(response, 404) def test_fail_to_retrieve_with_invalid_toolchain_name(self): self.login_jackdoe() - url = reverse("api_toolchains:object", args=["jackdoe", "unknown"]) + url = reverse("api_toolchains:object", args=["jackdoe", "unknown", 1]) response = self.client.get(url) self.checkResponse(response, 404) @@ -1429,13 +1419,6 @@ class ToolchainDeletion(ToolchainsAPIBase): response = self.client.delete(url) self.checkResponse(response, 404) - def test_fail_to_delete_without_version_number(self): - self.login_jackdoe() - - url = reverse("api_toolchains:object", args=["jackdoe", "personal"]) - response = self.client.delete(url) - self.checkResponse(response, 400) - def test_no_deletion_of_not_owned_toolchain(self): self.login_johndoe() response = self.client.delete(self.url)