Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: tests/test_xtm_translate.py

Issue 29908581: Issue #7036 - [XTM Integration] Add support for providing workflow name (Closed)
Patch Set: Addressed comments from Patch Set 1 Created Oct. 18, 2018, 4:23 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/test_xtm_translate.py
diff --git a/tests/test_xtm_translate.py b/tests/test_xtm_translate.py
index 7ffe31d9f8ea60d058d50f38e14e841a297f7908..c0eb51cc0a877836a7145568efc069a308020d65 100644
--- a/tests/test_xtm_translate.py
+++ b/tests/test_xtm_translate.py
@@ -24,12 +24,10 @@ import json
import pytest
from cms.translations.xtm import constants as const
-from cms.translations.xtm.projects_handler import (
- create_project, upload_files, download_files,
-)
from cms.translations.xtm.cli import (
generate_token, handle_projects as main_project_handler,
)
+from tests.utils import XtmMockArgs
_CMD_START = ['python', '-m', 'cms.bin.xtm_translations']
@@ -42,39 +40,6 @@ _ENV_TOKEN_VALID[const.Token.ENV_VAR] = 'TheXTM-APIToken-VALID'
_ENV_TOKEN_INVALID = dict(os.environ)
_ENV_TOKEN_INVALID[const.Token.ENV_VAR] = 'TheXTM-APIToken-INVALID'
-
-class _CreationArgsNamespace:
- def __init__(self):
- pass
-
- name = 'bar'
- desc = 'foo'
- client_id = 10
- ref_id = 'faz'
- workflow_id = 20
- save_id = False
- source_dir = None
- projects_func = staticmethod(create_project)
- source_lang = 'en_US'
-
-
-class _UploadArgsNamespace:
- def __init__(self):
- pass
-
- source_dir = None
- projects_func = staticmethod(upload_files)
- no_overwrite = False
-
-
-class _DownloadArgsNamespace:
- def __init__(self):
- pass
-
- source_dir = None
- projects_func = staticmethod(download_files)
-
-
_CREATION_ARGS_DEFAULT = ['--name', 'bar', '--desc', 'foo', '--client-id',
'10', '--ref-id', 'faz', '--workflow-id', '20']
_CREATION_ARGS_INVALID_TYPE_1 = ['--name', 'bar', '--desc', 'foo',
@@ -84,6 +49,10 @@ _CREATION_ARGS_INVALID_TYPE_2 = ['--name', 'bar', '--desc', 'foo',
'--client-id', '23', '--ref-id', 'faz',
'--workflow-id', 'foo']
+_UploadArgsNamespace = XtmMockArgs.UploadArgsNamespace
+_CreationArgsNamespace = XtmMockArgs.CreationArgsNamespace
+_DownloadArgsNamespace = XtmMockArgs.DownloadArgsNamespace
+
@pytest.fixture
def env_valid_token():
@@ -99,8 +68,9 @@ def env_valid_token():
'{login,create,upload,download} ...'),
(['create', '-h'], 'usage: xtm_translations.py create [-h] --name NAME '
'--desc DESC --client-id CLIENT_ID --ref-id REF_ID '
- '--workflow-id WORKFLOW_ID [--source-lang SOURCE_LANG] '
- '[--save-id] [source_dir]'),
+ '[--workflow-id WORKFLOW_ID] [--source-lang '
+ 'SOURCE_LANG] [--save-id] [--workflow-name '
+ 'WORKFLOW_NAME] [source_dir]'),
(['upload', '-h'], 'usage: xtm_translations.py upload [-h] '
'[--no-overwrite] [source_dir]'),
(['download', '-h'], 'usage: xtm_translations.py download [-h] '
« no previous file with comments | « tests/test_xtm_api.py ('k') | tests/test_xtm_translations_utils.py » ('j') | tests/utils.py » ('J')

Powered by Google App Engine
This is Rietveld