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

Unified Diff: tests/test_xtm_translate.py

Issue 29968558: Issue 7037 - [XTM Integration] Make REST API url customizable
Patch Set: Addressed comments Created Sept. 17, 2019, 12:22 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
« no previous file with comments | « tests/test_xtm_api.py ('k') | tests/test_xtm_translations_utils.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/test_xtm_translate.py
diff --git a/tests/test_xtm_translate.py b/tests/test_xtm_translate.py
index c0eb51cc0a877836a7145568efc069a308020d65..03dc406ef7ceef9ee89fdda17f4841447daac317 100644
--- a/tests/test_xtm_translate.py
+++ b/tests/test_xtm_translate.py
@@ -64,7 +64,7 @@ def env_valid_token():
@pytest.mark.script_launch_mode('subprocess')
@pytest.mark.parametrize('args,exp_msg', [
- (['-h'], 'usage: xtm_translations.py [-h] [-v] '
+ (['-h'], 'usage: xtm_translations.py [-h] [-v] [--api-urlAPI_URL]'
'{login,create,upload,download} ...'),
(['create', '-h'], 'usage: xtm_translations.py create [-h] --name NAME '
'--desc DESC --client-id CLIENT_ID --ref-id REF_ID '
@@ -116,12 +116,12 @@ def test_default_source_directory(args, script_runner):
const.ErrorMessages.NO_TOKEN_PROVIDED.split('\n')[0]),
('str(temp_site_valid_project)', _CREATION_ARGS_DEFAULT, _ENV_TOKEN_VALID,
const.ErrorMessages.PROJECT_EXISTS.format(1234)),
- ('str(temp_site)', _CREATION_ARGS_DEFAULT, _ENV_TOKEN_INVALID,
+ ('str(temp_site_no_project)', _CREATION_ARGS_DEFAULT, _ENV_TOKEN_INVALID,
'Authentication failed'),
])
def test_creation_error_messages(temp_site, intercept, script_runner, args,
source_dir, temp_site_valid_project, env,
- exp_msg):
+ exp_msg, temp_site_no_project):
"""Test if error cases are treated correctly when creating a project."""
cmd = list(_CMD_START)
cmd.extend(['create', eval(source_dir)])
@@ -129,6 +129,9 @@ def test_creation_error_messages(temp_site, intercept, script_runner, args,
ret = script_runner.run(*cmd, env=env)
+ print(ret.stdout)
+ print(ret.returncode)
+
assert not ret.success
assert exp_msg in ret.stderr
@@ -172,7 +175,7 @@ def test_login(intercept, monkeypatch, capsys):
)
monkeypatch.setattr('getpass.getpass', lambda prompt: 'pass')
- generate_token(None)
+ generate_token(XtmMockArgs.LoginArgsNamespace)
out, err = capsys.readouterr()
assert err == ''
@@ -188,7 +191,7 @@ def test_login_wrong_credentials(intercept, monkeypatch, capsys):
monkeypatch.setattr('getpass.getpass', lambda prompt: 'pass')
monkeypatch.setattr('sys.exit', lambda x: sys.stderr.write(str(x)))
- generate_token(None)
+ generate_token(XtmMockArgs.LoginArgsNamespace)
out, err = capsys.readouterr()
assert 'Invalid credentials' in err
« no previous file with comments | « tests/test_xtm_api.py ('k') | tests/test_xtm_translations_utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld