From 7b1264e2bdfd7bc5d289de0d28676495d49998a6 Mon Sep 17 00:00:00 2001 From: Changcheng Xiao Date: Thu, 20 Apr 2017 18:14:52 +0200 Subject: [PATCH] Replace digest auth with basic auth in 'populate-fixture-data.py' Change-Id: I9ff111dd56a743b9307ca7eb31764afc99ccc4c8 --- contrib/populate-fixture-data.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/populate-fixture-data.py b/contrib/populate-fixture-data.py index b77c41a819..0e3dffe823 100644 --- a/contrib/populate-fixture-data.py +++ b/contrib/populate-fixture-data.py @@ -46,7 +46,7 @@ GROUPS_URL = BASE_URL + "groups/" PLUGINS_URL = BASE_URL + "plugins/" PROJECTS_URL = BASE_URL + "projects/" -ADMIN_DIGEST = requests.auth.HTTPDigestAuth("admin", "secret") +ADMIN_BASIC_AUTH = requests.auth.HTTPBasicAuth("admin", "secret") # GROUP_ADMIN stores a GroupInfo for the admin group (see Gerrit rest docs) # In addition, GROUP_ADMIN["name"] stores the admin group"s name. @@ -151,8 +151,8 @@ def clean(json_string): return json_string -def digest_auth(user): - return requests.auth.HTTPDigestAuth(user["username"], user["http_password"]) +def basic_auth(user): + return requests.auth.HTTPBasicAuth(user["username"], user["http_password"]) def fetch_admin_group(): @@ -160,7 +160,7 @@ def fetch_admin_group(): # Get admin group r = json.loads(clean(requests.get(GROUPS_URL + "?suggest=ad&p=All-Projects", headers=HEADERS, - auth=ADMIN_DIGEST).text)) + auth=ADMIN_BASIC_AUTH).text)) admin_group_name = r.keys()[0] GROUP_ADMIN = r[admin_group_name] GROUP_ADMIN["name"] = admin_group_name @@ -225,7 +225,7 @@ def create_gerrit_groups(): requests.put(GROUPS_URL + g["name"], json.dumps(g), headers=HEADERS, - auth=ADMIN_DIGEST) + auth=ADMIN_BASIC_AUTH) return [g["name"] for g in groups] @@ -247,7 +247,7 @@ def create_gerrit_projects(owner_groups): requests.put(PROJECTS_URL + p["name"], json.dumps(p), headers=HEADERS, - auth=ADMIN_DIGEST) + auth=ADMIN_BASIC_AUTH) return [p["name"] for p in projects] @@ -256,7 +256,7 @@ def create_gerrit_users(gerrit_users): requests.put(ACCOUNTS_URL + user["username"], json.dumps(user), headers=HEADERS, - auth=ADMIN_DIGEST) + auth=ADMIN_BASIC_AUTH) def create_change(user, project_name): @@ -270,7 +270,7 @@ def create_change(user, project_name): requests.post(CHANGES_URL, json.dumps(change), headers=HEADERS, - auth=digest_auth(user)) + auth=basic_auth(user)) def clean_up():