Commit 7cb21fad authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic '9.0-fixes'

1128922f user_public: update with a sample from a 9.0 deployment
16a3920c fetch_from_gitlab: fix the name of the user_public fetcher
cf8c35e0

 fetch_from_gitlab: support importing as a module
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Brad King's avatarBrad King <brad.king@kitware.com>
Merge-request: !85
parents 6e2fdfe0 1128922f
......@@ -2,7 +2,6 @@
import json
import requests
import sys
def fetch_from_gitlab(token, endpoint, **kwargs):
......@@ -32,18 +31,20 @@ MR_ID = 20215 # https://gitlab.kitware.com/utils/rust-gitlab/merge_requests/35
NOTE_ID = 177359
token = sys.argv[1]
write_result(token, 'user_full', '/user')
write_result(token, 'user', '/users/%d' % USER)
write_result(token, 'project', '/projects/%s' % REPO)
write_result(token, 'project_hook', '/projects/%s/hooks' % REPO)
write_result(token, 'member', '/groups/utils/members')
write_result(token, 'repo_branch', '/projects/%s/repository/branches/master' % REPO)
write_result(token, 'repo_commit_detail', '/projects/%s/repository/commits/%s' % (REPO, COMMIT))
write_result(token, 'commit_note', '/projects/%s/repository/commits/%s/comments' % (REPO, COMMIT))
write_result(token, 'commit_status', '/projects/%s/repository/commits/%s/statuses' % (REPO, COMMIT))
write_result(token, 'issue', '/projects/%s/issues/%d' % (REPO, ISSUE_ID))
write_result(token, 'merge_request', '/projects/%s/merge_requests/%d' % (REPO, MR_ID))
write_result(token, 'issue_reference', '/projects/%s/merge_requests/%d/closes_issues' % (REPO, MR_ID))
write_result(token, 'note', '/projects/%s/merge_requests/%d/notes' % (REPO, MR_ID))
write_result(token, 'award_emoji', '/projects/%s/merge_requests/%d/notes/%d/award_emoji' % (REPO, MR_ID, NOTE_ID))
if __name__ == '__main__':
import sys
token = sys.argv[1]
write_result(token, 'user_public', '/user')
write_result(token, 'user', '/users/%d' % USER)
write_result(token, 'project', '/projects/%s' % REPO)
write_result(token, 'project_hook', '/projects/%s/hooks' % REPO)
write_result(token, 'member', '/groups/utils/members')
write_result(token, 'repo_branch', '/projects/%s/repository/branches/master' % REPO)
write_result(token, 'repo_commit_detail', '/projects/%s/repository/commits/%s' % (REPO, COMMIT))
write_result(token, 'commit_note', '/projects/%s/repository/commits/%s/comments' % (REPO, COMMIT))
write_result(token, 'commit_status', '/projects/%s/repository/commits/%s/statuses' % (REPO, COMMIT))
write_result(token, 'issue', '/projects/%s/issues/%d' % (REPO, ISSUE_ID))
write_result(token, 'merge_request', '/projects/%s/merge_requests/%d' % (REPO, MR_ID))
write_result(token, 'issue_reference', '/projects/%s/merge_requests/%d/closes_issues' % (REPO, MR_ID))
write_result(token, 'note', '/projects/%s/merge_requests/%d/notes' % (REPO, MR_ID))
write_result(token, 'award_emoji', '/projects/%s/merge_requests/%d/notes/%d/award_emoji' % (REPO, MR_ID, NOTE_ID))
{"two_factor_enabled": true, "can_create_project": true, "confirmed_at": "2015-02-26T12:23:28.693-05:00", "twitter": "", "linkedin": "", "color_scheme_id": 2, "web_url": "https://gitlab.kitware.com/ben.boeckel", "skype": "", "identities": [], "id": 13, "projects_limit": 50, "current_sign_in_at": "2016-12-07T11:15:50.720-05:00", "state": "active", "location": null, "email": "ben.boeckel@kitware.com", "website_url": "", "username": "ben.boeckel", "bio": null, "last_sign_in_at": "2016-12-07T10:05:56.167-05:00", "is_admin": false, "external": false, "organization": null, "name": "Ben Boeckel", "can_create_group": true, "created_at": "2015-02-26T12:23:28.730-05:00", "avatar_url": "https://secure.gravatar.com/avatar/2f5f7e99190174edb5a2f66b8653b0b2?s=80&d=identicon", "theme_id": 2}
{"two_factor_enabled": true, "can_create_project": true, "confirmed_at": "2015-02-26T12:23:28.693-05:00", "twitter": "", "linkedin": "", "color_scheme_id": 2, "web_url": "https://gitlab.kitware.com/ben.boeckel", "skype": "", "identities": [], "id": 13, "projects_limit": 50, "current_sign_in_at": "2017-04-03T13:34:33.907-04:00", "state": "active", "location": null, "email": "ben.boeckel@kitware.com", "website_url": "", "username": "ben.boeckel", "bio": null, "last_sign_in_at": "2017-04-03T12:23:14.579-04:00", "is_admin": false, "external": false, "name": "Ben Boeckel", "can_create_group": true, "created_at": "2015-02-26T12:23:28.730-05:00", "avatar_url": "https://secure.gravatar.com/avatar/2f5f7e99190174edb5a2f66b8653b0b2?s=80&d=identicon", "organization": null}
......@@ -517,18 +517,17 @@ fn test_read_user_public() {
assert_eq!(user_public.website_url, "");
assert_eq!(user_public.organization, None);
assert_eq!(user_public.last_sign_in_at,
Some(UTC.ymd(2016, 12, 7)
.and_hms_milli(15, 5, 56, 167)));
Some(UTC.ymd(2017, 4, 3)
.and_hms_milli(16, 23, 14, 579)));
assert_eq!(user_public.confirmed_at,
UTC.ymd(2015, 2, 26)
.and_hms_milli(17, 23, 28, 693));
assert_eq!(user_public.email, "ben.boeckel@kitware.com");
assert_eq!(user_public.theme_id, ThemeId::new(2));
assert_eq!(user_public.color_scheme_id, ColorSchemeId::new(2));
assert_eq!(user_public.projects_limit, 50);
assert_eq!(user_public.current_sign_in_at,
Some(UTC.ymd(2016, 12, 7)
.and_hms_milli(16, 15, 50, 720)));
Some(UTC.ymd(2017, 4, 3)
.and_hms_milli(17, 34, 33, 907)));
assert!(user_public.identities.is_empty());
assert_eq!(user_public.can_create_group, true);
assert_eq!(user_public.can_create_project, true);
......
......@@ -197,8 +197,6 @@ pub struct UserPublic {
/// The primary email address for the user.
pub email: String,
/// The theme used by the user.
pub theme_id: ThemeId,
/// The color scheme used by the user.
pub color_scheme_id: ColorSchemeId,
/// The number of projects the user may create.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment