From 2bd680ee82e0a7b7a3de525ec768e51e58a2e854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= <16805946+edgarrmondragon@users.noreply.github.com> Date: Wed, 29 May 2024 17:52:38 -0600 Subject: [PATCH] test: Test the `survey_name` parameter of `import_survey` (#1154) --- tests/integration/test_rpc_client.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/integration/test_rpc_client.py b/tests/integration/test_rpc_client.py index 311528a7..17d309d2 100644 --- a/tests/integration/test_rpc_client.py +++ b/tests/integration/test_rpc_client.py @@ -6,6 +6,7 @@ import io import json import operator +import random import typing as t import uuid from datetime import datetime @@ -160,6 +161,25 @@ def test_survey(client: citric.Client): assert new_props["format"] == enums.NewSurveyType.ALL_ON_ONE_PAGE +@pytest.mark.integration_test +def test_import_survey(client: citric.Client, subtests: SubTests): + """Test importing a survey with a custom ID and name.""" + survey_id = random.randint(10000, 20000) # noqa: S311 + with Path("./examples/survey.lss").open("rb") as f: + imported_id = client.import_survey( + f, + survey_id=survey_id, + survey_name="Custom Name", + ) + + with subtests.test(msg="imported survey has custom ID"): + assert imported_id == survey_id + + survey_props = client.get_language_properties(imported_id) + with subtests.test(msg="imported survey has custom name"): + assert survey_props["surveyls_title"] == "Custom Name" + + @pytest.mark.integration_test def test_copy_survey_destination_id( request: pytest.FixtureRequest,