Commit af090e7e authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'gitlab-12.1'

f8c93940 types: update for 12.1
b8d338af types: Organize project feature-enabled fields
51d75852 test: Update sample project data
b76345d0 test: Update sample issue data
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Reviewed-by: Ben Boeckel's avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !156
parents 8b4691a8 f8c93940
......@@ -42,7 +42,9 @@
"has_tasks": false,
"id": 69328,
"iid": 6,
"labels": [],
"labels": [
"area:doc"
],
"merge_requests_count": 1,
"milestone": null,
"project_id": 855,
......@@ -59,7 +61,7 @@
"total_time_spent": 0
},
"title": "fix documentation warnings",
"updated_at": "2017-07-07T02:31:03.757-04:00",
"updated_at": "2019-07-17T09:53:48.869-04:00",
"upvotes": 0,
"user_notes_count": 0,
"web_url": "https://gitlab.kitware.com/utils/rust-gitlab/issues/6"
......
......@@ -9,7 +9,14 @@
"self": "https://gitlab.kitware.com/api/v4/projects/855"
},
"archived": false,
"auto_cancel_pending_pipelines": "enabled",
"auto_devops_deploy_strategy": "continuous",
"auto_devops_enabled": false,
"avatar_url": null,
"build_coverage_regex": "",
"build_git_strategy": "fetch",
"build_timeout": 3600,
"builds_access_level": "disabled",
"ci_config_path": null,
"ci_default_git_depth": null,
"container_registry_enabled": true,
......@@ -18,17 +25,18 @@
"default_branch": "master",
"description": "Rust library for communicating with a Gitlab instance.",
"empty_repo": false,
"external_authorization_classification_label": null,
"forks_count": 7,
"forks_count": 17,
"http_url_to_repo": "https://gitlab.kitware.com/utils/rust-gitlab.git",
"id": 855,
"import_error": null,
"import_status": "none",
"issues_access_level": "enabled",
"issues_enabled": true,
"jobs_enabled": false,
"last_activity_at": "2018-05-31T11:08:12.338-04:00",
"last_activity_at": "2019-07-30T12:42:57.649-04:00",
"lfs_enabled": true,
"merge_method": "merge",
"merge_requests_access_level": "enabled",
"merge_requests_enabled": true,
"name": "rust-gitlab",
"name_with_namespace": "Utils / rust-gitlab",
......@@ -44,7 +52,7 @@
},
"only_allow_merge_if_all_discussions_are_resolved": null,
"only_allow_merge_if_pipeline_succeeds": false,
"open_issues_count": 6,
"open_issues_count": 8,
"path": "rust-gitlab",
"path_with_namespace": "utils/rust-gitlab",
"permissions": {
......@@ -57,15 +65,18 @@
"printing_merge_request_link_enabled": true,
"public_jobs": true,
"readme_url": "https://gitlab.kitware.com/utils/rust-gitlab/blob/master/README.md",
"repository_access_level": "enabled",
"request_access_enabled": true,
"resolve_outdated_diff_discussions": null,
"shared_runners_enabled": true,
"shared_with_groups": [],
"snippets_access_level": "disabled",
"snippets_enabled": false,
"ssh_url_to_repo": "git@gitlab.kitware.com:utils/rust-gitlab.git",
"star_count": 1,
"star_count": 6,
"tag_list": [],
"visibility": "public",
"web_url": "https://gitlab.kitware.com/utils/rust-gitlab",
"wiki_access_level": "enabled",
"wiki_enabled": true
}
......@@ -151,11 +151,12 @@ fn test_read_issue() {
);
assert_eq!(
issue.updated_at,
Utc.ymd(2017, 7, 7).and_hms_milli(6, 31, 03, 757),
Utc.ymd(2019, 7, 17).and_hms_milli(13, 53, 48, 869),
);
assert_eq!(issue.closed_at, None);
assert!(issue.closed_by.is_none());
assert!(issue.labels.is_empty());
assert_eq!(issue.labels.len(), 1);
assert_eq!(issue.labels[0], "area:doc");
assert!(issue.milestone.is_none());
assert_eq!(issue.author.username, "ben.boeckel");
assert_eq!(
......@@ -503,7 +504,7 @@ fn test_read_project() {
);
assert_eq!(
project.last_activity_at,
Utc.ymd(2018, 5, 31).and_hms_milli(15, 8, 12, 338),
Utc.ymd(2019, 7, 30).and_hms_milli(16, 42, 57, 649),
);
assert_eq!(project.import_error, None);
assert_eq!(project.shared_runners_enabled, true);
......@@ -523,9 +524,9 @@ fn test_read_project() {
assert!(project.forked_from_project.is_none());
assert_eq!(project.avatar_url, None);
assert_eq!(project.ci_config_path, None);
assert_eq!(project.star_count, 1);
assert_eq!(project.forks_count, 7);
assert_eq!(project.open_issues_count, Some(6));
assert_eq!(project.star_count, 6);
assert_eq!(project.forks_count, 17);
assert_eq!(project.open_issues_count, Some(8));
assert_eq!(project.public_jobs, true);
assert!(project.shared_with_groups.is_empty());
assert_eq!(project.only_allow_merge_if_pipeline_succeeds, Some(false));
......@@ -535,12 +536,21 @@ fn test_read_project() {
);
assert_eq!(project.printing_merge_request_link_enabled, Some(true));
assert_eq!(project.request_access_enabled, true);
assert_eq!(project.jobs_enabled, false);
assert_eq!(project.resolve_outdated_diff_discussions, None);
assert_eq!(project.jobs_enabled, false);
assert_eq!(project.issues_enabled, true);
assert_eq!(project.merge_requests_enabled, true);
assert_eq!(project.snippets_enabled, false);
assert_eq!(project.wiki_enabled, true);
assert_eq!(project.builds_access_level, FeatureVisibilityLevel::Disabled);
assert_eq!(project.issues_access_level, FeatureVisibilityLevel::Enabled);
assert_eq!(project.merge_requests_access_level, FeatureVisibilityLevel::Enabled);
assert_eq!(project.repository_access_level, FeatureVisibilityLevel::Enabled);
assert_eq!(project.snippets_access_level, FeatureVisibilityLevel::Disabled);
assert_eq!(project.wiki_access_level, FeatureVisibilityLevel::Enabled);
assert_eq!(project.merge_method, Some("merge".to_string()));
if let Some(ref permissions) = project.permissions {
if let Some(ref group_access) = permissions.group_access {
......
......@@ -468,6 +468,25 @@ enum_serialize!(VisibilityLevel -> "visibility level",
Private => "private",
);
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
/// Visibility levels for project features.
pub enum FeatureVisibilityLevel {
/// Feature is disabled.
Disabled,
/// Feature is enabled and accessible privately.
Private,
/// Feature is enabled and accessible with project-wide visibility level.
Enabled,
/// Feature is enabled and accessible publicly.
Public,
}
enum_serialize!(FeatureVisibilityLevel -> "feature visibility level",
Disabled => "disabled",
Private => "private",
Enabled => "enabled",
Public => "public",
);
// TODO: enum for NotificationLevel
#[cfg_attr(feature = "strict", serde(deny_unknown_fields))]
......@@ -613,11 +632,12 @@ pub struct Project {
pub printing_merge_request_link_enabled: Option<bool>,
/// Whether access to the project may be requested.
pub request_access_enabled: bool,
/// Whether jobs are enabled or not.
pub jobs_enabled: bool,
/// Whether to automatically resolve merge request diff discussions when they become outdated,
/// if configured.
pub resolve_outdated_diff_discussions: Option<bool>,
/// Whether jobs are enabled or not.
pub jobs_enabled: bool,
/// Whether issues are enabled or not.
pub issues_enabled: bool,
/// Whether merge requests are enabled or not.
......@@ -626,6 +646,20 @@ pub struct Project {
pub snippets_enabled: bool,
/// Whether the project wiki is enabled or not.
pub wiki_enabled: bool,
/// Visibility of builds.
pub builds_access_level: FeatureVisibilityLevel,
/// Visibility of issues.
pub issues_access_level: FeatureVisibilityLevel,
/// Visibility of merge requests.
pub merge_requests_access_level: FeatureVisibilityLevel,
/// Visibility of repository.
pub repository_access_level: FeatureVisibilityLevel,
/// Visibility of snippets.
pub snippets_access_level: FeatureVisibilityLevel,
/// Visibility of wiki.
pub wiki_access_level: FeatureVisibilityLevel,
/// The merge method used when merging merge request.
pub merge_method: Option<String>,
/// Statistics about the project.
......
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