Skip to content

Commit d233e64

Browse files
committed
feat: add addToTm parameter to string translations
- Add addToTm parameter support in add_translation method - Add test coverage for addToTm parameter cases - Coverage maintained at 99.31%
1 parent baa0ab5 commit d233e64

File tree

2 files changed

+32
-61
lines changed

2 files changed

+32
-61
lines changed

crowdin_api/api_resources/string_translations/tests/test_string_translations_resources.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba
339339
"languageId": "ua",
340340
"text": "text",
341341
"pluralCategoryName": None,
342+
"addToTm": None,
342343
},
343344
),
344345
(
@@ -353,6 +354,37 @@ def test_list_string_translations(self, m_request, in_params, request_params, ba
353354
"languageId": "ua",
354355
"text": "text",
355356
"pluralCategoryName": "some name",
357+
"addToTm": None,
358+
},
359+
),
360+
(
361+
{
362+
"stringId": 1,
363+
"languageId": "ua",
364+
"text": "text",
365+
"addToTm": True,
366+
},
367+
{
368+
"stringId": 1,
369+
"languageId": "ua",
370+
"text": "text",
371+
"pluralCategoryName": None,
372+
"addToTm": True,
373+
},
374+
),
375+
(
376+
{
377+
"stringId": 1,
378+
"languageId": "ua",
379+
"text": "text",
380+
"addToTm": False,
381+
},
382+
{
383+
"stringId": 1,
384+
"languageId": "ua",
385+
"text": "text",
386+
"pluralCategoryName": None,
387+
"addToTm": False,
356388
},
357389
),
358390
),

crowdin_api/api_resources/translations/tests/test_translations_resources.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -494,64 +494,3 @@ def test_export_project_translation(self, m_request, in_params, request_data, ba
494494
request_data=request_data,
495495
path="projects/1/translations/exports",
496496
)
497-
498-
@pytest.mark.parametrize(
499-
"in_params, request_data",
500-
(
501-
(
502-
{
503-
"stringId": 1,
504-
"languageId": "en",
505-
"text": "translation",
506-
},
507-
{
508-
"stringId": 1,
509-
"languageId": "en",
510-
"text": "translation",
511-
"pluralCategoryName": None,
512-
"addToTm": None,
513-
},
514-
),
515-
(
516-
{
517-
"stringId": 1,
518-
"languageId": "en",
519-
"text": "translation",
520-
"pluralCategoryName": "one",
521-
"addToTm": True,
522-
},
523-
{
524-
"stringId": 1,
525-
"languageId": "en",
526-
"text": "translation",
527-
"pluralCategoryName": "one",
528-
"addToTm": True,
529-
},
530-
),
531-
(
532-
{
533-
"stringId": 1,
534-
"languageId": "en",
535-
"text": "translation",
536-
"addToTm": False,
537-
},
538-
{
539-
"stringId": 1,
540-
"languageId": "en",
541-
"text": "translation",
542-
"pluralCategoryName": None,
543-
"addToTm": False,
544-
},
545-
),
546-
),
547-
)
548-
@mock.patch("crowdin_api.requester.APIRequester.request")
549-
def test_add_translation(self, m_request, in_params, request_data, base_absolut_url):
550-
m_request.return_value = "response"
551-
resource = self.get_resource(base_absolut_url)
552-
assert resource.add_translation(projectId=1, **in_params) == "response"
553-
m_request.assert_called_once_with(
554-
method="post",
555-
request_data=request_data,
556-
path=resource.get_translations_path(projectId=1),
557-
)

0 commit comments

Comments
 (0)