diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-21 01:18:32 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2019-02-21 01:18:32 +0100 |
commit | 63d9308284c417accbe9b8abfadcd67ad9d17957 (patch) | |
tree | 8aaaa87e00791d1ed9501199a6b08ed7877ab83b /kpov_judge | |
parent | aa6170a5655853a8e64375e7abca5845bc82bec3 (diff) |
test_task: simplify getting user login
Diffstat (limited to 'kpov_judge')
-rwxr-xr-x | kpov_judge/test_task.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kpov_judge/test_task.py b/kpov_judge/test_task.py index 4e9561f..aa9a268 100755 --- a/kpov_judge/test_task.py +++ b/kpov_judge/test_task.py @@ -181,16 +181,18 @@ if __name__ == '__main__': if not tokens.get(task_name): # get the student's ID and password # TODO clunky, should refactor all argument-getting stuff - fetch_params_meta = {'username': {'descriptions': {'si': 'Uporabniško ime', 'en': 'Username'}}} - params = get_params(params, fetch_params_meta, params['language']) - fetch_pass_meta = {'password': {'descriptions': {'si': 'Geslo', 'en': 'Password'}, 'masked': True}} - params_pass = get_params({}, fetch_pass_meta, params['language']) + user_meta = collections.OrderedDict(( + ('username', {'descriptions': {'si': 'Uporabniško ime', 'en': 'Username'}}), + ('password', {'descriptions': {'si': 'Geslo', 'en': 'Password'}, 'masked': True}), + )) + user_params = get_params(params, user_meta, params['language']) - http_auth(task_url, params['username'], params_pass['password']) + http_auth(task_url, user_params['username'], user_params['password']) response = urllib.request.urlopen('{task_url}/{task_name}/token.json'.format(**params)) response = json.load(io.TextIOWrapper(response)) if response: tokens[task_name] = response['token'] + params['username'] = user_params['username'] except Exception as ex: print(ex) |