summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xkpov_judge/test_task.py12
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)