Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
Lower case for user. (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergii-mamedov authored May 16, 2019
1 parent 239e322 commit 51dad12
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions datarobot_batch_scoring/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ def _main(argv, deployment_aware=False):

if not generic_opts['dry_run']:
user = user or ui.prompt_user()
user = user.lower()
user = user.strip()

if not api_token and not pwd:
Expand Down
55 changes: 55 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,61 @@
)


def test_lower_case_for_user(monkeypatch):
main_args = ['--host',
'http://localhost:53646/api',
'--user', '[email protected]',
'56dd9570018e213242dfa93c',
'56dd9570018e213242dfa93d',
'tests/fixtures/temperatura_predict.csv',
'--n_samples',
'10',
'--n_concurrent', '1']

monkeypatch.setattr('datarobot_batch_scoring.main.UI', mock.Mock(spec=UI))

with mock.patch(
'datarobot_batch_scoring.main'
'.run_batch_predictions') as mock_method:
main(argv=main_args)
mock_method.assert_called_once_with(
base_url='http://localhost:53646/predApi/v1.0/',
base_headers={},
user='[email protected]',
pwd=mock.ANY,
api_token=None,
create_api_token=False,
pid='56dd9570018e213242dfa93c',
lid='56dd9570018e213242dfa93d',
deployment_id=None,
import_id=None,
n_retry=3,
concurrent=1,
resume=None,
n_samples=10,
out_file='out.csv',
keep_cols=None,
delimiter=None,
dataset='tests/fixtures/temperatura_predict.csv',
pred_name=None,
pred_threshold_name=None,
pred_decision_name=None,
timeout=None,
ui=mock.ANY,
auto_sample=False,
fast_mode=False,
dry_run=False,
encoding='',
skip_dialect=False,
skip_row_id=False,
output_delimiter=None,
compression=False,
field_size_limit=None,
verify_ssl=True,
max_prediction_explanations=0,
)


def test_without_passed_user_and_passwd(monkeypatch):
main_args = ['--host',
'http://localhost:53646/api',
Expand Down

0 comments on commit 51dad12

Please sign in to comment.