diff --git a/beat/web/algorithms/tests/tests_api.py b/beat/web/algorithms/tests/tests_api.py index 32756499719055cc0fc9128156f43564e9e1d9ad..d4fc549bb835cd113c28289c8853cdbfa7b5a92f 100755 --- a/beat/web/algorithms/tests/tests_api.py +++ b/beat/web/algorithms/tests/tests_api.py @@ -699,7 +699,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.checkAlgorithm(algorithm) def test_not_used_valid_name__no_description_no_code(self): @@ -750,7 +750,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.checkAlgorithm(algorithm) def test_not_used_invalid_name__no_description_no_code(self): @@ -809,7 +809,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.checkAlgorithm( algorithm, AlgorithmsAPIBase.DECLARATION, AlgorithmsAPIBase.CODE ) @@ -879,7 +879,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.checkAlgorithm( algorithm, AlgorithmsAPIBase.DECLARATION, AlgorithmsAPIBase.CODE ) @@ -1068,7 +1068,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.assertEqual(algorithm.language, Code.CXX) self.assertFalse(algorithm.valid()) @@ -1116,7 +1116,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.assertEqual(algorithm.language, Code.CXX) self.assertTrue(algorithm.valid()) self.checkAlgorithm( @@ -1156,7 +1156,7 @@ class AlgorithmCreation(AlgorithmsAPIBase): ) self.assertEqual(algorithm.short_description, "") - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") self.assertEqual(algorithm.language, Code.CXX) self.assertTrue(algorithm.valid()) self.checkAlgorithm( @@ -1250,7 +1250,7 @@ class AlgorithmUpdate(AlgorithmsAPIBase): algorithm = Algorithm.objects.get( author__username="jackdoe", name="personal", version=1 ) - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") storage = beat.core.algorithm.Storage(settings.PREFIX, algorithm.fullname()) storage.language = "python" @@ -1320,7 +1320,7 @@ class AlgorithmUpdate(AlgorithmsAPIBase): algorithm = Algorithm.objects.get( author__username="jackdoe", name="personal", version=1 ) - self.assertEqual(algorithm.description, b"blah") + self.assertEqual(algorithm.description, "blah") def test_successful_declaration_only(self): self.login_jackdoe() diff --git a/beat/web/dataformats/tests/tests_api.py b/beat/web/dataformats/tests/tests_api.py index 0fb943b03a17e839ded4e41de05387a3ba0a7027..beb373f484bb9953a10e903b31c79d93ceafe4e6 100644 --- a/beat/web/dataformats/tests/tests_api.py +++ b/beat/web/dataformats/tests/tests_api.py @@ -550,7 +550,7 @@ class DataFormatUpdate(DataFormatsAPIBase): dataformat = DataFormat.objects.get( author__username="johndoe", name="format_private" ) - self.assertEqual(dataformat.description, b"blah") + self.assertEqual(dataformat.description, "blah") storage = Storage(settings.PREFIX, dataformat.fullname()) self.assertTrue(storage.exists()) @@ -601,7 +601,7 @@ class DataFormatUpdate(DataFormatsAPIBase): self.checkResponse(response, 200, content_type="application/json") dataformat = DataFormat.objects.get(author__username="johndoe", name="format1") - self.assertEqual(dataformat.description, b"blah") + self.assertEqual(dataformat.description, "blah") def test_successful_update_of_declaration_only(self): self.login_johndoe() diff --git a/beat/web/libraries/tests/tests_api.py b/beat/web/libraries/tests/tests_api.py index b46ced7f6e634265b73425771a0b7061ceffc04b..02fd68c51ff989502db23e5156f15989032ae1ae 100644 --- a/beat/web/libraries/tests/tests_api.py +++ b/beat/web/libraries/tests/tests_api.py @@ -432,7 +432,7 @@ class LibraryCreation(LibrariesAPIBase): library = Library.objects.get(author__username="jackdoe", name="valid-name1") self.assertEqual(library.short_description, "") - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") self.checkLibrary(library) def test_not_used_valid_name__no_description_no_code(self): @@ -479,7 +479,7 @@ class LibraryCreation(LibrariesAPIBase): library = Library.objects.get(author__username="jackdoe", name="invalid-name1") self.assertEqual(library.short_description, "") - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") self.checkLibrary(library) def test_not_used_invalid_name__no_description_no_code(self): @@ -534,7 +534,7 @@ class LibraryCreation(LibrariesAPIBase): library = Library.objects.get(author__username="jackdoe", name="valid-name1") self.assertEqual(library.short_description, "") - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") self.checkLibrary(library, LibrariesAPIBase.DECLARATION, LibrariesAPIBase.CODE) def test_not_used_valid_name__no_description(self): @@ -596,7 +596,7 @@ class LibraryCreation(LibrariesAPIBase): library = Library.objects.get(author__username="jackdoe", name="invalid-name1") self.assertEqual(library.short_description, "") - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") self.checkLibrary(library, LibrariesAPIBase.DECLARATION, LibrariesAPIBase.CODE) @@ -851,12 +851,12 @@ class LibraryUpdate(LibrariesAPIBase): library = Library.objects.get( author__username="jackdoe", name="personal", version=1 ) - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") storage = beat.core.library.Storage(settings.PREFIX, library.fullname()) storage.language = "python" self.assertTrue(storage.exists()) - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") self.assertEqual( json.loads(storage.json.load()), json.loads(LibrariesAPIBase.UPDATE) ) @@ -923,7 +923,7 @@ class LibraryUpdate(LibrariesAPIBase): library = Library.objects.get( author__username="jackdoe", name="personal", version=1 ) - self.assertEqual(library.description, b"blah") + self.assertEqual(library.description, "blah") def test_successful_update_declaration_only(self): self.login_jackdoe() diff --git a/beat/web/toolchains/tests.py b/beat/web/toolchains/tests.py index 0187b5eb3fe49ca976b74e6439fce500754844ae..0f036546758b23ec382605b3f580fb1e024b2095 100644 --- a/beat/web/toolchains/tests.py +++ b/beat/web/toolchains/tests.py @@ -26,23 +26,22 @@ ############################################################################### +import json import os import shutil -import json -from django.test import TestCase -from django.contrib.auth.models import User from django.conf import settings +from django.contrib.auth.models import User +from django.test import TestCase from django.urls import reverse import beat.core.toolchain -from .models import Toolchain - from ..common.models import Shareable from ..common.testutils import BaseTestCase -from ..common.testutils import tearDownModule # noqa test runner will call it from ..common.testutils import get_algorithms_from_data +from ..common.testutils import tearDownModule # noqa test runner will call it +from .models import Toolchain TEST_PWD = "1234" # nosec @@ -92,7 +91,7 @@ class ToolchainsCreationFunction(TestCase): self.assertEqual(toolchain.author, user) self.assertEqual(toolchain.name, "toolchain1") self.assertEqual(toolchain.short_description, "some description") - self.assertEqual(toolchain.description, b"some longer description") + self.assertEqual(toolchain.description, "some longer description") self.assertEqual(toolchain.sharing, Shareable.PRIVATE) self.assertTrue(toolchain.previous_version is None) self.assertTrue(toolchain.fork_of is None) @@ -119,7 +118,7 @@ class ToolchainsCreationFunction(TestCase): self.assertEqual(toolchain.author, user) self.assertEqual(toolchain.name, "toolchain1") self.assertEqual(toolchain.short_description, "some description") - self.assertEqual(toolchain.description, b"some longer description") + self.assertEqual(toolchain.description, "some longer description") self.assertEqual(toolchain.sharing, Shareable.PRIVATE) self.assertTrue(toolchain.previous_version is None) self.assertTrue(toolchain.fork_of is None) @@ -803,7 +802,7 @@ class ToolchainCreation(ToolchainsAPIBase): ) self.assertEqual(toolchain.short_description, "") - self.assertEqual(toolchain.description, b"blah") + self.assertEqual(toolchain.description, "blah") self.checkToolchainFile(toolchain.fullname()) @@ -910,7 +909,7 @@ class ToolchainCreation(ToolchainsAPIBase): self.assertEqual(content, {"name": ["This field is required."]}) def test_unsuccessful_forking_of_non_accredited_person_public_for_one_user_toolchain( - self + self, ): self.login_janedoe() @@ -985,8 +984,8 @@ class ToolchainCreation(ToolchainsAPIBase): author__username="janedoe", name="name1", version=1 ) - self.assertEqual(toolchain_forked.description, b"blah") - self.assertEqual(toolchain.description, b"") + self.assertEqual(toolchain_forked.description, "blah") + self.assertEqual(toolchain.description, "") self.assertEqual(toolchain_forked.fork_of, toolchain) orginal_storage = beat.core.toolchain.Storage( @@ -1037,7 +1036,7 @@ class ToolchainCreation(ToolchainsAPIBase): ) self.assertEqual(toolchain.short_description, "") - self.assertEqual(toolchain_forked.description, b"blah") + self.assertEqual(toolchain_forked.description, "blah") self.assertEqual(toolchain_forked.fork_of, toolchain) orginal_storage = beat.core.toolchain.Storage( @@ -1215,7 +1214,7 @@ class ToolchainUpdate(ToolchainsAPIBase): self.checkResponse(response, 200, content_type="application/json") toolchain = Toolchain.objects.get(author__username="jackdoe", name="personal") - self.assertEqual(toolchain.description, b"blah") + self.assertEqual(toolchain.description, "blah") def test_successful_update_declaration_only(self): self.login_jackdoe() @@ -1283,7 +1282,7 @@ class ToolchainUpdate(ToolchainsAPIBase): data = self.checkResponse(response, 200, content_type="application/json") toolchain = Toolchain.objects.get(author__username="jackdoe", name="personal") - self.assertEqual(toolchain.description, b"blah") + self.assertEqual(toolchain.description, "blah") response = self.client.get(self.url) data = self.checkResponse(response, 200, content_type="application/json")