From e2a6e82ade49d0e831ea220ecf4660bb5ad38e78 Mon Sep 17 00:00:00 2001 From: David <9059044+Tansito@users.noreply.github.com> Date: Wed, 13 Mar 2024 14:14:48 -0400 Subject: [PATCH] Fix upload serialization argument vs env_vars --- gateway/api/v1/serializers.py | 5 ++--- gateway/tests/api/test_v1_serializers.py | 14 ++++++-------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/gateway/api/v1/serializers.py b/gateway/api/v1/serializers.py index 73f17367c..27efd0bb0 100644 --- a/gateway/api/v1/serializers.py +++ b/gateway/api/v1/serializers.py @@ -16,7 +16,7 @@ class Meta(serializers.ProgramSerializer.Meta): "entrypoint", "artifact", "dependencies", - "env_vars", + "arguments", "public", ] @@ -38,8 +38,7 @@ class Meta(serializers.UploadProgramSerializer.Meta): "entrypoint", "artifact", "dependencies", - "env_vars", - "public", + "arguments", ] diff --git a/gateway/tests/api/test_v1_serializers.py b/gateway/tests/api/test_v1_serializers.py index 41a58ebe6..ee9f30da2 100644 --- a/gateway/tests/api/test_v1_serializers.py +++ b/gateway/tests/api/test_v1_serializers.py @@ -55,13 +55,13 @@ def test_upload_program_serializer_creates_program(self): title = "Hello world" entrypoint = "pattern.py" - env_vars = "{}" + arguments = "{}" dependencies = "[]" data = {} data["title"] = title data["entrypoint"] = entrypoint - data["env_vars"] = env_vars + data["arguments"] = arguments data["dependencies"] = dependencies data["artifact"] = upload_file @@ -71,7 +71,7 @@ def test_upload_program_serializer_creates_program(self): program: Program = serializer.save(author=user) self.assertEqual(title, program.title) self.assertEqual(entrypoint, program.entrypoint) - self.assertEqual(env_vars, program.env_vars) + self.assertEqual(arguments, program.arguments) self.assertEqual(dependencies, program.dependencies) def test_upload_program_serializer_fails_at_validation(self): @@ -86,8 +86,6 @@ def test_upload_program_serializer_fails_at_validation(self): "artifact.tar", data.read(), content_type="multipart/form-data" ) - user = models.User.objects.get(username="test_user") - title = "Hello world" entrypoint = "pattern.py" @@ -98,15 +96,15 @@ def test_upload_program_serializer_fails_at_validation(self): errors = serializer.errors self.assertListEqual(["title", "entrypoint", "artifact"], list(errors.keys())) - env_vars = {} + arguments = {} dependencies = [] data["title"] = title data["entrypoint"] = entrypoint data["artifact"] = upload_file - data["env_vars"] = env_vars + data["arguments"] = arguments data["dependencies"] = dependencies serializer = UploadProgramSerializer(data=data) self.assertFalse(serializer.is_valid()) errors = serializer.errors - self.assertListEqual(["dependencies", "env_vars"], list(errors.keys())) + self.assertListEqual(["dependencies", "arguments"], list(errors.keys()))