gitlab/api/projects/
edit.rs

1// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
2// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
4// option. This file may not be copied, modified, or distributed
5// except according to those terms.
6
7use std::collections::BTreeSet;
8
9use derive_builder::Builder;
10
11use crate::api::common::{EnableState, NameOrId, VisibilityLevel};
12use crate::api::endpoint_prelude::*;
13use crate::api::projects::{
14    AutoDevOpsDeployStrategy, BuildGitStrategy, ContainerExpirationPolicy, FeatureAccessLevel,
15    FeatureAccessLevelPublic, MergeMethod, SquashOption,
16};
17
18/// Edit an existing project.
19#[derive(Debug, Builder, Clone)]
20#[builder(setter(strip_option))]
21pub struct EditProject<'a> {
22    /// The project to edit.
23    #[builder(setter(into))]
24    project: NameOrId<'a>,
25
26    /// The name of the project.
27    #[builder(setter(into), default)]
28    name: Option<Cow<'a, str>>,
29    /// The path of the project.
30    #[builder(setter(into), default)]
31    path: Option<Cow<'a, str>>,
32
33    /// The default branch of the new project.
34    #[builder(setter(into), default)]
35    default_branch: Option<Cow<'a, str>>,
36    /// The description of the new project.
37    #[builder(setter(into), default)]
38    description: Option<Cow<'a, str>>,
39
40    /// Set the access level for issues.
41    #[builder(default)]
42    issues_access_level: Option<FeatureAccessLevel>,
43    /// Set the access level for repository access.
44    #[builder(default)]
45    repository_access_level: Option<FeatureAccessLevel>,
46    /// Set the access level for container registry access.
47    #[builder(default)]
48    container_registry_access_level: Option<FeatureAccessLevel>,
49    /// Set the access level for merge requests.
50    #[builder(default)]
51    merge_requests_access_level: Option<FeatureAccessLevel>,
52    /// Set the access level for making a fork of the project.
53    #[builder(default)]
54    forking_access_level: Option<FeatureAccessLevel>,
55    /// Set the access level for CI pipeline access.
56    #[builder(default)]
57    builds_access_level: Option<FeatureAccessLevel>,
58    /// Set the access level for access to view the wiki.
59    #[builder(default)]
60    wiki_access_level: Option<FeatureAccessLevel>,
61    /// Set the access level for snippets.
62    #[builder(default)]
63    snippets_access_level: Option<FeatureAccessLevel>,
64    /// Set the access level for GitLab Pages on the project.
65    #[builder(default)]
66    pages_access_level: Option<FeatureAccessLevelPublic>,
67    /// Set the access level for requirements features.
68    #[builder(default)]
69    requirements_access_level: Option<FeatureAccessLevel>,
70    /// Set the access level for analytics features.
71    #[builder(default)]
72    analytics_access_level: Option<FeatureAccessLevel>,
73    /// Set the access level for security and compliance features.
74    #[builder(default)]
75    security_and_compliance_access_level: Option<FeatureAccessLevel>,
76    /// Set the access level for release access.
77    #[builder(default)]
78    releases_access_level: Option<FeatureAccessLevel>,
79    /// Set the access level for environment access.
80    #[builder(default)]
81    environments_access_level: Option<FeatureAccessLevel>,
82    /// Set the access level for feature flag access.
83    #[builder(default)]
84    feature_flags_access_level: Option<FeatureAccessLevel>,
85    /// Set the access level for infrastructure access.
86    #[builder(default)]
87    infrastructure_access_level: Option<FeatureAccessLevel>,
88    /// Set the access level for monitoring access.
89    #[builder(default)]
90    monitor_access_level: Option<FeatureAccessLevel>,
91    /// Set the access level for model experiment access.
92    #[builder(default)]
93    model_experiments_access_level: Option<FeatureAccessLevel>,
94
95    /// Whether to enable email notifications or not.
96    #[builder(default)]
97    emails_enabled: Option<bool>,
98    /// Whether the default set of award emojis are shown for this project.
99    #[builder(default)]
100    show_default_award_emojis: Option<bool>,
101    /// Whether to allow non-members to set pipeline variables when triggering pipelines or not.
102    #[builder(default)]
103    restrict_user_defined_variables: Option<bool>,
104    /// Whether outdated diff discussions are resolved when a merge request is updated or not.
105    #[builder(default)]
106    resolve_outdated_diff_discussions: Option<bool>,
107    /// The expiration policy for containers.
108    #[builder(default)]
109    container_expiration_policy_attributes: Option<ContainerExpirationPolicy<'a>>,
110    /// Enable or disable the ability to push to the project repository using job token.
111    #[builder(default)]
112    ci_push_repository_for_job_token_allowed: Option<bool>,
113    /// Whether the project can use shared runners or not.
114    #[builder(default)]
115    shared_runners_enabled: Option<bool>,
116    /// The visibility level of the project.
117    #[builder(default)]
118    visibility: Option<VisibilityLevel>,
119    /// A URL to import the repository from.
120    #[builder(setter(into), default)]
121    import_url: Option<Cow<'a, str>>,
122    /// Whether job results are visible to non-project members or not.
123    #[builder(default)]
124    public_builds: Option<bool>,
125    /// Whether the CI pipeline is required to succeed before merges are allowed.
126    #[builder(default)]
127    only_allow_merge_if_pipeline_succeeds: Option<bool>,
128    /// Whether the CI pipeline can be skipped before merges are allowed.
129    #[builder(default)]
130    allow_merge_on_skipped_pipeline: Option<bool>,
131    /// Whether all discussions must be resolved before merges are allowed.
132    #[builder(default)]
133    only_allow_merge_if_all_discussions_are_resolved: Option<bool>,
134    /// If `true`, merge requests may not be merged unless all status checks are passing.
135    #[builder(default)]
136    only_allow_merge_if_all_status_checks_passed: Option<bool>,
137    /// The merge commit template.
138    #[builder(setter(into), default)]
139    merge_commit_template: Option<Cow<'a, str>>,
140    /// The squash merge commit template.
141    #[builder(setter(into), default)]
142    squash_commit_template: Option<Cow<'a, str>>,
143    /// The default description for issues.
144    #[builder(setter(into), default)]
145    issues_template: Option<Cow<'a, str>>,
146    /// The default description for issues.
147    #[builder(setter(into), default)]
148    merge_requests_template: Option<Cow<'a, str>>,
149    /// The merge method to use for the project.
150    #[builder(default)]
151    merge_method: Option<MergeMethod>,
152    /// The squash option for the project.
153    #[builder(default)]
154    squash_option: Option<SquashOption>,
155    /// Whether merge pipelines are enabled.
156    #[builder(default)]
157    merge_pipelines_enabled: Option<bool>,
158    /// Whether merge trains are enabled.
159    #[builder(default)]
160    merge_trains_enabled: Option<bool>,
161    /// Whether MRs default to targing this project or the upstream project.
162    #[builder(default)]
163    mr_default_target_self: Option<bool>,
164    /// Whether issues referenced on the default branch should be closed or not.
165    #[builder(default)]
166    autoclose_referenced_issues: Option<bool>,
167    /// The commit message to use for code suggestion commits.
168    #[builder(setter(into), default)]
169    suggestion_commit_message: Option<Cow<'a, str>>,
170    /// Whether to enabled the "Remove source branch" option in new merge requests by default or
171    /// not.
172    #[builder(default)]
173    remove_source_branch_after_merge: Option<bool>,
174    /// Whether merge requests require an associated Jira issue or not.
175    #[builder(default)]
176    prevent_merge_without_jira_issue: Option<bool>,
177    /// Whether to enable print merge request links if branch/commits are pushed by console
178    #[builder(default)]
179    printing_merge_request_link_enabled: Option<bool>,
180    /// Whether `git-lfs` support should be enabled or not.
181    ///
182    /// See the [git-lfs](https://git-lfs.github.com/) website for more information.
183    #[builder(default)]
184    lfs_enabled: Option<bool>,
185    /// Whether users may request access to the repository or not.
186    #[builder(default)]
187    request_access_enabled: Option<bool>,
188    /// A list of tags to apply to the repository.
189    #[builder(setter(name = "_tag_list"), default, private)]
190    tag_list: BTreeSet<Cow<'a, str>>,
191    /// A list of topics to apply to the repository.
192    #[builder(setter(name = "_topics"), default, private)]
193    topics: BTreeSet<Cow<'a, str>>,
194    // TODO: Figure out how to actually use this.
195    // avatar   mixed   no  Image file for avatar of the project
196    // empty string is "delete avatar"
197    // avatar: ???,
198    /// The default Git strategy for CI jobs of the project.
199    #[builder(default)]
200    build_git_strategy: Option<BuildGitStrategy>,
201    /// The default timeout for jobs of the project (in seconds).
202    #[builder(default)]
203    build_timeout: Option<u64>,
204    /// Whether to automatically cancel pipelines when branches are updated when using a previous
205    /// version of the branch.
206    #[builder(setter(into), default)]
207    auto_cancel_pending_pipelines: Option<EnableState>,
208    /// The path to the GitLab CI configuration file within the repository.
209    ///
210    /// Defaults to `.gitlab-ci.yml`.
211    #[builder(setter(into), default)]
212    ci_config_path: Option<Cow<'a, str>>,
213    /// The default number of revisions to fetch in CI jobs.
214    #[builder(default)]
215    ci_default_git_depth: Option<u64>,
216    /// Whether to skip pending deployment jobs when a newer one is started.
217    #[builder(default)]
218    ci_forward_deployment_enabled: Option<bool>,
219    /// Whether Auto DevOps are enabled or not.
220    #[builder(default)]
221    auto_devops_enabled: Option<bool>,
222    /// The Auto Deploy strategy of the project.
223    #[builder(default)]
224    auto_devops_deploy_strategy: Option<AutoDevOpsDeployStrategy>,
225    /// The storage shard on which to store the repository.
226    #[builder(setter(into), default)]
227    repository_storage: Option<Cow<'a, str>>,
228    /// The classification label of the project.
229    #[builder(setter(into), default)]
230    external_authorization_classification_label: Option<Cow<'a, str>>,
231    /// Whether to enable pull mirroring for the project or not.
232    #[builder(default)]
233    mirror: Option<bool>,
234    /// User to attribute all mirror activity to.
235    #[builder(default)]
236    mirror_user_id: Option<u64>,
237    /// Whether mirror updates trigger CI builds ir not.
238    #[builder(default)]
239    mirror_trigger_builds: Option<bool>,
240    /// Whether to only mirror protected branches or not.
241    #[builder(default)]
242    only_mirror_protected_branches: Option<bool>,
243    /// Whether the mirror overwrites diverged branches in this project or not.
244    #[builder(default)]
245    mirror_overwrites_diverged_branches: Option<bool>,
246    /// Regular expression for branches to mirror.
247    #[builder(setter(into), default)]
248    mirror_branch_regex: Option<Cow<'a, str>>,
249    /// Whether the package repository is enabled or not.
250    #[builder(default)]
251    packages_enabled: Option<bool>,
252    /// Whether group runners are enabled for this project or not.
253    #[builder(default)]
254    group_runners_enabled: Option<bool>,
255    /// Whether the service desk is enabled or not.
256    #[builder(default)]
257    service_desk_enabled: Option<bool>,
258    /// Whether to keep the latest artifact for pipelines or not.
259    #[builder(default)]
260    keep_latest_artifact: Option<bool>,
261    /// Whether to or not caches should be separated based on branch protection status or not.
262    #[builder(default)]
263    ci_separated_caches: Option<bool>,
264    /// Whether to allow pipelines for MRs from forks to run in this project or not.
265    #[builder(default)]
266    ci_allow_fork_pipelines_to_run_in_parent_project: Option<bool>,
267    /// Whether to enforce authorization checks on uploads or not.
268    #[builder(default)]
269    enforce_auth_checks_on_uploads: Option<bool>,
270    /// The template for branch names when starting based on an issue.
271    #[builder(setter(into), default)]
272    issue_branch_template: Option<Cow<'a, str>>,
273    /// Whether to allow triggered pipelines to approve deployments or not.
274    #[builder(default)]
275    allow_pipeline_trigger_approve_deployment: Option<bool>,
276    /// Whether environments can be rolled back or not.
277    #[builder(default)]
278    ci_forward_deployment_rollback_allowed: Option<bool>,
279}
280
281impl<'a> EditProject<'a> {
282    /// Create a builder for the endpoint.
283    pub fn builder() -> EditProjectBuilder<'a> {
284        EditProjectBuilder::default()
285    }
286}
287
288impl<'a> EditProjectBuilder<'a> {
289    /// Add a topic.
290    pub fn topic<T>(&mut self, topic: T) -> &mut Self
291    where
292        T: Into<Cow<'a, str>>,
293    {
294        self.topics
295            .get_or_insert_with(BTreeSet::new)
296            .insert(topic.into());
297        self
298    }
299
300    /// Add multiple topics.
301    pub fn topics<I, T>(&mut self, iter: I) -> &mut Self
302    where
303        I: Iterator<Item = T>,
304        T: Into<Cow<'a, str>>,
305    {
306        self.topics
307            .get_or_insert_with(BTreeSet::new)
308            .extend(iter.map(Into::into));
309        self
310    }
311}
312
313impl Endpoint for EditProject<'_> {
314    fn method(&self) -> Method {
315        Method::PUT
316    }
317
318    fn endpoint(&self) -> Cow<'static, str> {
319        format!("projects/{}", self.project).into()
320    }
321
322    fn body(&self) -> Result<Option<(&'static str, Vec<u8>)>, BodyError> {
323        let mut params = FormParams::default();
324
325        params
326            .push_opt("name", self.name.as_ref())
327            .push_opt("path", self.path.as_ref())
328            .push_opt("default_branch", self.default_branch.as_ref())
329            .push_opt("description", self.description.as_ref())
330            .push_opt("issues_access_level", self.issues_access_level)
331            .push_opt("repository_access_level", self.repository_access_level)
332            .push_opt(
333                "container_registry_access_level",
334                self.container_registry_access_level,
335            )
336            .push_opt(
337                "merge_requests_access_level",
338                self.merge_requests_access_level,
339            )
340            .push_opt("forking_access_level", self.forking_access_level)
341            .push_opt("builds_access_level", self.builds_access_level)
342            .push_opt("wiki_access_level", self.wiki_access_level)
343            .push_opt("snippets_access_level", self.snippets_access_level)
344            .push_opt("pages_access_level", self.pages_access_level)
345            .push_opt("requirements_access_level", self.requirements_access_level)
346            .push_opt("analytics_access_level", self.analytics_access_level)
347            .push_opt(
348                "security_and_compliance_access_level",
349                self.security_and_compliance_access_level,
350            )
351            .push_opt("releases_access_level", self.releases_access_level)
352            .push_opt("environments_access_level", self.environments_access_level)
353            .push_opt(
354                "feature_flags_access_level",
355                self.feature_flags_access_level,
356            )
357            .push_opt(
358                "infrastructure_access_level",
359                self.infrastructure_access_level,
360            )
361            .push_opt("monitor_access_level", self.monitor_access_level)
362            .push_opt(
363                "model_experiments_access_level",
364                self.model_experiments_access_level,
365            )
366            .push_opt("emails_enabled", self.emails_enabled)
367            .push_opt("show_default_award_emojis", self.show_default_award_emojis)
368            .push_opt(
369                "restrict_user_defined_variables",
370                self.restrict_user_defined_variables,
371            )
372            .push_opt(
373                "resolve_outdated_diff_discussions",
374                self.resolve_outdated_diff_discussions,
375            )
376            .push_opt(
377                "ci_push_repository_for_job_token_allowed",
378                self.ci_push_repository_for_job_token_allowed,
379            )
380            .push_opt("shared_runners_enabled", self.shared_runners_enabled)
381            .push_opt("visibility", self.visibility)
382            .push_opt("import_url", self.import_url.as_ref())
383            .push_opt("public_builds", self.public_builds)
384            .push_opt(
385                "only_allow_merge_if_pipeline_succeeds",
386                self.only_allow_merge_if_pipeline_succeeds,
387            )
388            .push_opt(
389                "allow_merge_on_skipped_pipeline",
390                self.allow_merge_on_skipped_pipeline,
391            )
392            .push_opt(
393                "only_allow_merge_if_all_discussions_are_resolved",
394                self.only_allow_merge_if_all_discussions_are_resolved,
395            )
396            .push_opt(
397                "only_allow_merge_if_all_status_checks_passed",
398                self.only_allow_merge_if_all_status_checks_passed,
399            )
400            .push_opt("merge_commit_template", self.merge_commit_template.as_ref())
401            .push_opt(
402                "squash_commit_template",
403                self.squash_commit_template.as_ref(),
404            )
405            .push_opt("issues_template", self.issues_template.as_ref())
406            .push_opt(
407                "merge_requests_template",
408                self.merge_requests_template.as_ref(),
409            )
410            .push_opt("merge_method", self.merge_method)
411            .push_opt("squash_option", self.squash_option)
412            .push_opt("merge_pipelines_enabled", self.merge_pipelines_enabled)
413            .push_opt("merge_trains_enabled", self.merge_trains_enabled)
414            .push_opt("mr_default_target_self", self.mr_default_target_self)
415            .push_opt(
416                "autoclose_referenced_issues",
417                self.autoclose_referenced_issues,
418            )
419            .push_opt(
420                "suggestion_commit_message",
421                self.suggestion_commit_message.as_ref(),
422            )
423            .push_opt(
424                "remove_source_branch_after_merge",
425                self.remove_source_branch_after_merge,
426            )
427            .push_opt(
428                "prevent_merge_without_jira_issue",
429                self.prevent_merge_without_jira_issue,
430            )
431            .push_opt(
432                "printing_merge_request_link_enabled",
433                self.printing_merge_request_link_enabled,
434            )
435            .push_opt("lfs_enabled", self.lfs_enabled)
436            .push_opt("request_access_enabled", self.request_access_enabled)
437            .extend(self.tag_list.iter().map(|value| ("tag_list[]", value)))
438            .extend(self.topics.iter().map(|value| ("topics[]", value)))
439            .push_opt("build_git_strategy", self.build_git_strategy)
440            .push_opt("build_timeout", self.build_timeout)
441            .push_opt(
442                "auto_cancel_pending_pipelines",
443                self.auto_cancel_pending_pipelines,
444            )
445            .push_opt("ci_config_path", self.ci_config_path.as_ref())
446            .push_opt("ci_default_git_depth", self.ci_default_git_depth)
447            .push_opt(
448                "ci_forward_deployment_enabled",
449                self.ci_forward_deployment_enabled,
450            )
451            .push_opt("auto_devops_enabled", self.auto_devops_enabled)
452            .push_opt(
453                "auto_devops_deploy_strategy",
454                self.auto_devops_deploy_strategy,
455            )
456            .push_opt("repository_storage", self.repository_storage.as_ref())
457            .push_opt(
458                "external_authorization_classification_label",
459                self.external_authorization_classification_label.as_ref(),
460            )
461            .push_opt("mirror", self.mirror)
462            .push_opt("mirror_user_id", self.mirror_user_id)
463            .push_opt("mirror_trigger_builds", self.mirror_trigger_builds)
464            .push_opt(
465                "only_mirror_protected_branches",
466                self.only_mirror_protected_branches,
467            )
468            .push_opt(
469                "mirror_overwrites_diverged_branches",
470                self.mirror_overwrites_diverged_branches,
471            )
472            .push_opt("mirror_branch_regex", self.mirror_branch_regex.as_ref())
473            .push_opt("packages_enabled", self.packages_enabled)
474            .push_opt("group_runners_enabled", self.group_runners_enabled)
475            .push_opt("service_desk_enabled", self.service_desk_enabled)
476            .push_opt("keep_latest_artifact", self.keep_latest_artifact)
477            .push_opt("ci_separated_caches", self.ci_separated_caches)
478            .push_opt(
479                "ci_allow_fork_pipelines_to_run_in_parent_project",
480                self.ci_allow_fork_pipelines_to_run_in_parent_project,
481            )
482            .push_opt(
483                "enforce_auth_checks_on_uploads",
484                self.enforce_auth_checks_on_uploads,
485            )
486            .push_opt("issue_branch_template", self.issue_branch_template.as_ref())
487            .push_opt(
488                "allow_pipeline_trigger_approve_deployment",
489                self.allow_pipeline_trigger_approve_deployment,
490            )
491            .push_opt(
492                "ci_forward_deployment_rollback_allowed",
493                self.ci_forward_deployment_rollback_allowed,
494            );
495
496        if let Some(policy) = self.container_expiration_policy_attributes.as_ref() {
497            policy.add_query(&mut params);
498        }
499
500        params.into_body()
501    }
502}
503
504#[cfg(test)]
505mod tests {
506    use crate::api::common::{EnableState, VisibilityLevel};
507    use crate::api::projects::{
508        AutoDevOpsDeployStrategy, BuildGitStrategy, ContainerExpirationCadence,
509        ContainerExpirationKeepN, ContainerExpirationOlderThan, ContainerExpirationPolicy,
510        EditProject, EditProjectBuilderError, FeatureAccessLevel, FeatureAccessLevelPublic,
511        MergeMethod, SquashOption,
512    };
513    use crate::api::{self, Query};
514    use crate::test::client::{ExpectedUrl, SingleTestClient};
515    use http::Method;
516
517    #[test]
518    fn project_is_needed() {
519        let err = EditProject::builder().build().unwrap_err();
520        crate::test::assert_missing_field!(err, EditProjectBuilderError, "project");
521    }
522
523    #[test]
524    fn project_is_sufficient() {
525        EditProject::builder().project("project").build().unwrap();
526    }
527
528    #[test]
529    fn endpoint() {
530        let endpoint = ExpectedUrl::builder()
531            .method(Method::PUT)
532            .endpoint("projects/simple%2Fproject")
533            .content_type("application/x-www-form-urlencoded")
534            .body_str("")
535            .build()
536            .unwrap();
537        let client = SingleTestClient::new_raw(endpoint, "");
538
539        let endpoint = EditProject::builder()
540            .project("simple/project")
541            .build()
542            .unwrap();
543        api::ignore(endpoint).query(&client).unwrap();
544    }
545
546    #[test]
547    fn endpoint_name() {
548        let endpoint = ExpectedUrl::builder()
549            .method(Method::PUT)
550            .endpoint("projects/simple%2Fproject")
551            .content_type("application/x-www-form-urlencoded")
552            .body_str("name=name")
553            .build()
554            .unwrap();
555        let client = SingleTestClient::new_raw(endpoint, "");
556
557        let endpoint = EditProject::builder()
558            .project("simple/project")
559            .name("name")
560            .build()
561            .unwrap();
562        api::ignore(endpoint).query(&client).unwrap();
563    }
564
565    #[test]
566    fn endpoint_path() {
567        let endpoint = ExpectedUrl::builder()
568            .method(Method::PUT)
569            .endpoint("projects/simple%2Fproject")
570            .content_type("application/x-www-form-urlencoded")
571            .body_str("path=path")
572            .build()
573            .unwrap();
574        let client = SingleTestClient::new_raw(endpoint, "");
575
576        let endpoint = EditProject::builder()
577            .project("simple/project")
578            .path("path")
579            .build()
580            .unwrap();
581        api::ignore(endpoint).query(&client).unwrap();
582    }
583
584    #[test]
585    fn endpoint_default_branch() {
586        let endpoint = ExpectedUrl::builder()
587            .method(Method::PUT)
588            .endpoint("projects/simple%2Fproject")
589            .content_type("application/x-www-form-urlencoded")
590            .body_str("default_branch=master")
591            .build()
592            .unwrap();
593        let client = SingleTestClient::new_raw(endpoint, "");
594
595        let endpoint = EditProject::builder()
596            .project("simple/project")
597            .default_branch("master")
598            .build()
599            .unwrap();
600        api::ignore(endpoint).query(&client).unwrap();
601    }
602
603    #[test]
604    fn endpoint_description() {
605        let endpoint = ExpectedUrl::builder()
606            .method(Method::PUT)
607            .endpoint("projects/simple%2Fproject")
608            .content_type("application/x-www-form-urlencoded")
609            .body_str("description=description")
610            .build()
611            .unwrap();
612        let client = SingleTestClient::new_raw(endpoint, "");
613
614        let endpoint = EditProject::builder()
615            .project("simple/project")
616            .description("description")
617            .build()
618            .unwrap();
619        api::ignore(endpoint).query(&client).unwrap();
620    }
621
622    #[test]
623    fn endpoint_issues_access_level() {
624        let endpoint = ExpectedUrl::builder()
625            .method(Method::PUT)
626            .endpoint("projects/simple%2Fproject")
627            .content_type("application/x-www-form-urlencoded")
628            .body_str("issues_access_level=enabled")
629            .build()
630            .unwrap();
631        let client = SingleTestClient::new_raw(endpoint, "");
632
633        let endpoint = EditProject::builder()
634            .project("simple/project")
635            .issues_access_level(FeatureAccessLevel::Enabled)
636            .build()
637            .unwrap();
638        api::ignore(endpoint).query(&client).unwrap();
639    }
640
641    #[test]
642    fn endpoint_repository_access_level() {
643        let endpoint = ExpectedUrl::builder()
644            .method(Method::PUT)
645            .endpoint("projects/simple%2Fproject")
646            .content_type("application/x-www-form-urlencoded")
647            .body_str("repository_access_level=disabled")
648            .build()
649            .unwrap();
650        let client = SingleTestClient::new_raw(endpoint, "");
651
652        let endpoint = EditProject::builder()
653            .project("simple/project")
654            .repository_access_level(FeatureAccessLevel::Disabled)
655            .build()
656            .unwrap();
657        api::ignore(endpoint).query(&client).unwrap();
658    }
659
660    #[test]
661    fn endpoint_container_registry_access_level() {
662        let endpoint = ExpectedUrl::builder()
663            .method(Method::PUT)
664            .endpoint("projects/simple%2Fproject")
665            .content_type("application/x-www-form-urlencoded")
666            .body_str("container_registry_access_level=disabled")
667            .build()
668            .unwrap();
669        let client = SingleTestClient::new_raw(endpoint, "");
670
671        let endpoint = EditProject::builder()
672            .project("simple/project")
673            .container_registry_access_level(FeatureAccessLevel::Disabled)
674            .build()
675            .unwrap();
676        api::ignore(endpoint).query(&client).unwrap();
677    }
678
679    #[test]
680    fn endpoint_merge_requests_access_level() {
681        let endpoint = ExpectedUrl::builder()
682            .method(Method::PUT)
683            .endpoint("projects/simple%2Fproject")
684            .content_type("application/x-www-form-urlencoded")
685            .body_str("merge_requests_access_level=private")
686            .build()
687            .unwrap();
688        let client = SingleTestClient::new_raw(endpoint, "");
689
690        let endpoint = EditProject::builder()
691            .project("simple/project")
692            .merge_requests_access_level(FeatureAccessLevel::Private)
693            .build()
694            .unwrap();
695        api::ignore(endpoint).query(&client).unwrap();
696    }
697
698    #[test]
699    fn endpoint_forking_access_level() {
700        let endpoint = ExpectedUrl::builder()
701            .method(Method::PUT)
702            .endpoint("projects/simple%2Fproject")
703            .content_type("application/x-www-form-urlencoded")
704            .body_str("forking_access_level=enabled")
705            .build()
706            .unwrap();
707        let client = SingleTestClient::new_raw(endpoint, "");
708
709        let endpoint = EditProject::builder()
710            .project("simple/project")
711            .forking_access_level(FeatureAccessLevel::Enabled)
712            .build()
713            .unwrap();
714        api::ignore(endpoint).query(&client).unwrap();
715    }
716
717    #[test]
718    fn endpoint_builds_access_level() {
719        let endpoint = ExpectedUrl::builder()
720            .method(Method::PUT)
721            .endpoint("projects/simple%2Fproject")
722            .content_type("application/x-www-form-urlencoded")
723            .body_str("builds_access_level=enabled")
724            .build()
725            .unwrap();
726        let client = SingleTestClient::new_raw(endpoint, "");
727
728        let endpoint = EditProject::builder()
729            .project("simple/project")
730            .builds_access_level(FeatureAccessLevel::Enabled)
731            .build()
732            .unwrap();
733        api::ignore(endpoint).query(&client).unwrap();
734    }
735
736    #[test]
737    fn endpoint_wiki_access_level() {
738        let endpoint = ExpectedUrl::builder()
739            .method(Method::PUT)
740            .endpoint("projects/simple%2Fproject")
741            .content_type("application/x-www-form-urlencoded")
742            .body_str("wiki_access_level=disabled")
743            .build()
744            .unwrap();
745        let client = SingleTestClient::new_raw(endpoint, "");
746
747        let endpoint = EditProject::builder()
748            .project("simple/project")
749            .wiki_access_level(FeatureAccessLevel::Disabled)
750            .build()
751            .unwrap();
752        api::ignore(endpoint).query(&client).unwrap();
753    }
754
755    #[test]
756    fn endpoint_snippets_access_level() {
757        let endpoint = ExpectedUrl::builder()
758            .method(Method::PUT)
759            .endpoint("projects/simple%2Fproject")
760            .content_type("application/x-www-form-urlencoded")
761            .body_str("snippets_access_level=disabled")
762            .build()
763            .unwrap();
764        let client = SingleTestClient::new_raw(endpoint, "");
765
766        let endpoint = EditProject::builder()
767            .project("simple/project")
768            .snippets_access_level(FeatureAccessLevel::Disabled)
769            .build()
770            .unwrap();
771        api::ignore(endpoint).query(&client).unwrap();
772    }
773
774    #[test]
775    fn endpoint_pages_access_level() {
776        let endpoint = ExpectedUrl::builder()
777            .method(Method::PUT)
778            .endpoint("projects/simple%2Fproject")
779            .content_type("application/x-www-form-urlencoded")
780            .body_str("pages_access_level=public")
781            .build()
782            .unwrap();
783        let client = SingleTestClient::new_raw(endpoint, "");
784
785        let endpoint = EditProject::builder()
786            .project("simple/project")
787            .pages_access_level(FeatureAccessLevelPublic::Public)
788            .build()
789            .unwrap();
790        api::ignore(endpoint).query(&client).unwrap();
791    }
792
793    #[test]
794    fn endpoint_requirements_access_level() {
795        let endpoint = ExpectedUrl::builder()
796            .method(Method::PUT)
797            .endpoint("projects/simple%2Fproject")
798            .content_type("application/x-www-form-urlencoded")
799            .body_str("requirements_access_level=enabled")
800            .build()
801            .unwrap();
802        let client = SingleTestClient::new_raw(endpoint, "");
803
804        let endpoint = EditProject::builder()
805            .project("simple/project")
806            .requirements_access_level(FeatureAccessLevel::Enabled)
807            .build()
808            .unwrap();
809        api::ignore(endpoint).query(&client).unwrap();
810    }
811
812    #[test]
813    fn endpoint_analytics_access_level() {
814        let endpoint = ExpectedUrl::builder()
815            .method(Method::PUT)
816            .endpoint("projects/simple%2Fproject")
817            .content_type("application/x-www-form-urlencoded")
818            .body_str("analytics_access_level=private")
819            .build()
820            .unwrap();
821        let client = SingleTestClient::new_raw(endpoint, "");
822
823        let endpoint = EditProject::builder()
824            .project("simple/project")
825            .analytics_access_level(FeatureAccessLevel::Private)
826            .build()
827            .unwrap();
828        api::ignore(endpoint).query(&client).unwrap();
829    }
830
831    #[test]
832    fn endpoint_security_and_compliance_access_level() {
833        let endpoint = ExpectedUrl::builder()
834            .method(Method::PUT)
835            .endpoint("projects/simple%2Fproject")
836            .content_type("application/x-www-form-urlencoded")
837            .body_str("security_and_compliance_access_level=private")
838            .build()
839            .unwrap();
840        let client = SingleTestClient::new_raw(endpoint, "");
841
842        let endpoint = EditProject::builder()
843            .project("simple/project")
844            .security_and_compliance_access_level(FeatureAccessLevel::Private)
845            .build()
846            .unwrap();
847        api::ignore(endpoint).query(&client).unwrap();
848    }
849
850    #[test]
851    fn endpoint_releases_access_level() {
852        let endpoint = ExpectedUrl::builder()
853            .method(Method::PUT)
854            .endpoint("projects/simple%2Fproject")
855            .content_type("application/x-www-form-urlencoded")
856            .body_str("releases_access_level=private")
857            .build()
858            .unwrap();
859        let client = SingleTestClient::new_raw(endpoint, "");
860
861        let endpoint = EditProject::builder()
862            .project("simple/project")
863            .releases_access_level(FeatureAccessLevel::Private)
864            .build()
865            .unwrap();
866        api::ignore(endpoint).query(&client).unwrap();
867    }
868
869    #[test]
870    fn endpoint_environments_access_level() {
871        let endpoint = ExpectedUrl::builder()
872            .method(Method::PUT)
873            .endpoint("projects/simple%2Fproject")
874            .content_type("application/x-www-form-urlencoded")
875            .body_str("environments_access_level=private")
876            .build()
877            .unwrap();
878        let client = SingleTestClient::new_raw(endpoint, "");
879
880        let endpoint = EditProject::builder()
881            .project("simple/project")
882            .environments_access_level(FeatureAccessLevel::Private)
883            .build()
884            .unwrap();
885        api::ignore(endpoint).query(&client).unwrap();
886    }
887
888    #[test]
889    fn endpoint_feature_flags_access_level() {
890        let endpoint = ExpectedUrl::builder()
891            .method(Method::PUT)
892            .endpoint("projects/simple%2Fproject")
893            .content_type("application/x-www-form-urlencoded")
894            .body_str("feature_flags_access_level=private")
895            .build()
896            .unwrap();
897        let client = SingleTestClient::new_raw(endpoint, "");
898
899        let endpoint = EditProject::builder()
900            .project("simple/project")
901            .feature_flags_access_level(FeatureAccessLevel::Private)
902            .build()
903            .unwrap();
904        api::ignore(endpoint).query(&client).unwrap();
905    }
906
907    #[test]
908    fn endpoint_infrastructure_access_level() {
909        let endpoint = ExpectedUrl::builder()
910            .method(Method::PUT)
911            .endpoint("projects/simple%2Fproject")
912            .content_type("application/x-www-form-urlencoded")
913            .body_str("infrastructure_access_level=private")
914            .build()
915            .unwrap();
916        let client = SingleTestClient::new_raw(endpoint, "");
917
918        let endpoint = EditProject::builder()
919            .project("simple/project")
920            .infrastructure_access_level(FeatureAccessLevel::Private)
921            .build()
922            .unwrap();
923        api::ignore(endpoint).query(&client).unwrap();
924    }
925
926    #[test]
927    fn endpoint_monitor_access_level() {
928        let endpoint = ExpectedUrl::builder()
929            .method(Method::PUT)
930            .endpoint("projects/simple%2Fproject")
931            .content_type("application/x-www-form-urlencoded")
932            .body_str("monitor_access_level=private")
933            .build()
934            .unwrap();
935        let client = SingleTestClient::new_raw(endpoint, "");
936
937        let endpoint = EditProject::builder()
938            .project("simple/project")
939            .monitor_access_level(FeatureAccessLevel::Private)
940            .build()
941            .unwrap();
942        api::ignore(endpoint).query(&client).unwrap();
943    }
944
945    #[test]
946    fn endpoint_model_experiments_access_level() {
947        let endpoint = ExpectedUrl::builder()
948            .method(Method::PUT)
949            .endpoint("projects/simple%2Fproject")
950            .content_type("application/x-www-form-urlencoded")
951            .body_str("model_experiments_access_level=private")
952            .build()
953            .unwrap();
954        let client = SingleTestClient::new_raw(endpoint, "");
955
956        let endpoint = EditProject::builder()
957            .project("simple/project")
958            .model_experiments_access_level(FeatureAccessLevel::Private)
959            .build()
960            .unwrap();
961        api::ignore(endpoint).query(&client).unwrap();
962    }
963
964    #[test]
965    fn endpoint_emails_enabled() {
966        let endpoint = ExpectedUrl::builder()
967            .method(Method::PUT)
968            .endpoint("projects/simple%2Fproject")
969            .content_type("application/x-www-form-urlencoded")
970            .body_str("emails_enabled=true")
971            .build()
972            .unwrap();
973        let client = SingleTestClient::new_raw(endpoint, "");
974
975        let endpoint = EditProject::builder()
976            .project("simple/project")
977            .emails_enabled(true)
978            .build()
979            .unwrap();
980        api::ignore(endpoint).query(&client).unwrap();
981    }
982
983    #[test]
984    fn endpoint_show_default_award_emojis() {
985        let endpoint = ExpectedUrl::builder()
986            .method(Method::PUT)
987            .endpoint("projects/simple%2Fproject")
988            .content_type("application/x-www-form-urlencoded")
989            .body_str("show_default_award_emojis=false")
990            .build()
991            .unwrap();
992        let client = SingleTestClient::new_raw(endpoint, "");
993
994        let endpoint = EditProject::builder()
995            .project("simple/project")
996            .show_default_award_emojis(false)
997            .build()
998            .unwrap();
999        api::ignore(endpoint).query(&client).unwrap();
1000    }
1001
1002    #[test]
1003    fn endpoint_restrict_user_defined_variables() {
1004        let endpoint = ExpectedUrl::builder()
1005            .method(Method::PUT)
1006            .endpoint("projects/simple%2Fproject")
1007            .content_type("application/x-www-form-urlencoded")
1008            .body_str("restrict_user_defined_variables=true")
1009            .build()
1010            .unwrap();
1011        let client = SingleTestClient::new_raw(endpoint, "");
1012
1013        let endpoint = EditProject::builder()
1014            .project("simple/project")
1015            .restrict_user_defined_variables(true)
1016            .build()
1017            .unwrap();
1018        api::ignore(endpoint).query(&client).unwrap();
1019    }
1020
1021    #[test]
1022    fn endpoint_resolve_outdated_diff_discussions() {
1023        let endpoint = ExpectedUrl::builder()
1024            .method(Method::PUT)
1025            .endpoint("projects/simple%2Fproject")
1026            .content_type("application/x-www-form-urlencoded")
1027            .body_str("resolve_outdated_diff_discussions=false")
1028            .build()
1029            .unwrap();
1030        let client = SingleTestClient::new_raw(endpoint, "");
1031
1032        let endpoint = EditProject::builder()
1033            .project("simple/project")
1034            .resolve_outdated_diff_discussions(false)
1035            .build()
1036            .unwrap();
1037        api::ignore(endpoint).query(&client).unwrap();
1038    }
1039
1040    #[test]
1041    fn endpoint_ci_push_repository_for_job_token_allowed() {
1042        let endpoint = ExpectedUrl::builder()
1043            .method(Method::PUT)
1044            .endpoint("projects/simple%2Fproject")
1045            .content_type("application/x-www-form-urlencoded")
1046            .body_str("ci_push_repository_for_job_token_allowed=false")
1047            .build()
1048            .unwrap();
1049        let client = SingleTestClient::new_raw(endpoint, "");
1050
1051        let endpoint = EditProject::builder()
1052            .project("simple/project")
1053            .ci_push_repository_for_job_token_allowed(false)
1054            .build()
1055            .unwrap();
1056        api::ignore(endpoint).query(&client).unwrap();
1057    }
1058
1059    #[test]
1060    fn endpoint_container_expiration_policy_attributes_cadence() {
1061        let endpoint = ExpectedUrl::builder()
1062            .method(Method::PUT)
1063            .endpoint("projects/simple%2Fproject")
1064            .content_type("application/x-www-form-urlencoded")
1065            .body_str("container_expiration_policy_attributes%5Bcadence%5D=7d")
1066            .build()
1067            .unwrap();
1068        let client = SingleTestClient::new_raw(endpoint, "");
1069
1070        let endpoint = EditProject::builder()
1071            .project("simple/project")
1072            .container_expiration_policy_attributes(
1073                ContainerExpirationPolicy::builder()
1074                    .cadence(ContainerExpirationCadence::OneWeek)
1075                    .build()
1076                    .unwrap(),
1077            )
1078            .build()
1079            .unwrap();
1080        api::ignore(endpoint).query(&client).unwrap();
1081    }
1082
1083    #[test]
1084    fn endpoint_container_expiration_policy_attributes_enabled() {
1085        let endpoint = ExpectedUrl::builder()
1086            .method(Method::PUT)
1087            .endpoint("projects/simple%2Fproject")
1088            .content_type("application/x-www-form-urlencoded")
1089            .body_str("container_expiration_policy_attributes%5Benabled%5D=true")
1090            .build()
1091            .unwrap();
1092        let client = SingleTestClient::new_raw(endpoint, "");
1093
1094        let endpoint = EditProject::builder()
1095            .project("simple/project")
1096            .container_expiration_policy_attributes(
1097                ContainerExpirationPolicy::builder()
1098                    .enabled(true)
1099                    .build()
1100                    .unwrap(),
1101            )
1102            .build()
1103            .unwrap();
1104        api::ignore(endpoint).query(&client).unwrap();
1105    }
1106
1107    #[test]
1108    fn endpoint_container_expiration_policy_attributes_keep_n() {
1109        let endpoint = ExpectedUrl::builder()
1110            .method(Method::PUT)
1111            .endpoint("projects/simple%2Fproject")
1112            .content_type("application/x-www-form-urlencoded")
1113            .body_str("container_expiration_policy_attributes%5Bkeep_n%5D=5")
1114            .build()
1115            .unwrap();
1116        let client = SingleTestClient::new_raw(endpoint, "");
1117
1118        let endpoint = EditProject::builder()
1119            .project("simple/project")
1120            .container_expiration_policy_attributes(
1121                ContainerExpirationPolicy::builder()
1122                    .keep_n(ContainerExpirationKeepN::Five)
1123                    .build()
1124                    .unwrap(),
1125            )
1126            .build()
1127            .unwrap();
1128        api::ignore(endpoint).query(&client).unwrap();
1129    }
1130
1131    #[test]
1132    fn endpoint_container_expiration_policy_attributes_older_than() {
1133        let endpoint = ExpectedUrl::builder()
1134            .method(Method::PUT)
1135            .endpoint("projects/simple%2Fproject")
1136            .content_type("application/x-www-form-urlencoded")
1137            .body_str("container_expiration_policy_attributes%5Bolder_than%5D=7d")
1138            .build()
1139            .unwrap();
1140        let client = SingleTestClient::new_raw(endpoint, "");
1141
1142        let endpoint = EditProject::builder()
1143            .project("simple/project")
1144            .container_expiration_policy_attributes(
1145                ContainerExpirationPolicy::builder()
1146                    .older_than(ContainerExpirationOlderThan::OneWeek)
1147                    .build()
1148                    .unwrap(),
1149            )
1150            .build()
1151            .unwrap();
1152        api::ignore(endpoint).query(&client).unwrap();
1153    }
1154
1155    #[test]
1156    fn endpoint_container_expiration_policy_attributes_name_regex_delete() {
1157        let endpoint = ExpectedUrl::builder()
1158            .method(Method::PUT)
1159            .endpoint("projects/simple%2Fproject")
1160            .content_type("application/x-www-form-urlencoded")
1161            .body_str("container_expiration_policy_attributes%5Bname_regex_delete%5D=%3Aoldest")
1162            .build()
1163            .unwrap();
1164        let client = SingleTestClient::new_raw(endpoint, "");
1165
1166        let endpoint = EditProject::builder()
1167            .project("simple/project")
1168            .container_expiration_policy_attributes(
1169                ContainerExpirationPolicy::builder()
1170                    .name_regex_delete(":oldest")
1171                    .build()
1172                    .unwrap(),
1173            )
1174            .build()
1175            .unwrap();
1176        api::ignore(endpoint).query(&client).unwrap();
1177    }
1178
1179    #[test]
1180    fn endpoint_container_expiration_policy_attributes_name_regex_keep() {
1181        let endpoint = ExpectedUrl::builder()
1182            .method(Method::PUT)
1183            .endpoint("projects/simple%2Fproject")
1184            .content_type("application/x-www-form-urlencoded")
1185            .body_str("container_expiration_policy_attributes%5Bname_regex_keep%5D=%3Alatest")
1186            .build()
1187            .unwrap();
1188        let client = SingleTestClient::new_raw(endpoint, "");
1189
1190        let endpoint = EditProject::builder()
1191            .project("simple/project")
1192            .container_expiration_policy_attributes(
1193                ContainerExpirationPolicy::builder()
1194                    .name_regex_keep(":latest")
1195                    .build()
1196                    .unwrap(),
1197            )
1198            .build()
1199            .unwrap();
1200        api::ignore(endpoint).query(&client).unwrap();
1201    }
1202
1203    #[test]
1204    fn endpoint_container_expiration_policy_attributes_all() {
1205        let endpoint = ExpectedUrl::builder()
1206            .method(Method::PUT)
1207            .endpoint("projects/simple%2Fproject")
1208            .content_type("application/x-www-form-urlencoded")
1209            .body_str(concat!(
1210                "container_expiration_policy_attributes%5Bcadence%5D=7d",
1211                "&container_expiration_policy_attributes%5Benabled%5D=true",
1212                "&container_expiration_policy_attributes%5Bkeep_n%5D=5",
1213                "&container_expiration_policy_attributes%5Bolder_than%5D=7d",
1214                "&container_expiration_policy_attributes%5Bname_regex_delete%5D=%3Aoldest",
1215                "&container_expiration_policy_attributes%5Bname_regex_keep%5D=%3Alatest",
1216            ))
1217            .build()
1218            .unwrap();
1219        let client = SingleTestClient::new_raw(endpoint, "");
1220
1221        let endpoint = EditProject::builder()
1222            .project("simple/project")
1223            .container_expiration_policy_attributes(
1224                ContainerExpirationPolicy::builder()
1225                    .cadence(ContainerExpirationCadence::OneWeek)
1226                    .enabled(true)
1227                    .keep_n(ContainerExpirationKeepN::Five)
1228                    .older_than(ContainerExpirationOlderThan::OneWeek)
1229                    .name_regex_keep(":latest")
1230                    .name_regex_delete(":oldest")
1231                    .build()
1232                    .unwrap(),
1233            )
1234            .build()
1235            .unwrap();
1236        api::ignore(endpoint).query(&client).unwrap();
1237    }
1238
1239    #[test]
1240    fn endpoint_shared_runners_enabled() {
1241        let endpoint = ExpectedUrl::builder()
1242            .method(Method::PUT)
1243            .endpoint("projects/simple%2Fproject")
1244            .content_type("application/x-www-form-urlencoded")
1245            .body_str("shared_runners_enabled=false")
1246            .build()
1247            .unwrap();
1248        let client = SingleTestClient::new_raw(endpoint, "");
1249
1250        let endpoint = EditProject::builder()
1251            .project("simple/project")
1252            .shared_runners_enabled(false)
1253            .build()
1254            .unwrap();
1255        api::ignore(endpoint).query(&client).unwrap();
1256    }
1257
1258    #[test]
1259    fn endpoint_visibility() {
1260        let endpoint = ExpectedUrl::builder()
1261            .method(Method::PUT)
1262            .endpoint("projects/simple%2Fproject")
1263            .content_type("application/x-www-form-urlencoded")
1264            .body_str("visibility=public")
1265            .build()
1266            .unwrap();
1267        let client = SingleTestClient::new_raw(endpoint, "");
1268
1269        let endpoint = EditProject::builder()
1270            .project("simple/project")
1271            .visibility(VisibilityLevel::Public)
1272            .build()
1273            .unwrap();
1274        api::ignore(endpoint).query(&client).unwrap();
1275    }
1276
1277    #[test]
1278    fn endpoint_import_url() {
1279        let endpoint = ExpectedUrl::builder()
1280            .method(Method::PUT)
1281            .endpoint("projects/simple%2Fproject")
1282            .content_type("application/x-www-form-urlencoded")
1283            .body_str("import_url=https%3A%2F%2Ftest.invalid%2Fpath%3Fsome%3Dfoo")
1284            .build()
1285            .unwrap();
1286        let client = SingleTestClient::new_raw(endpoint, "");
1287
1288        let endpoint = EditProject::builder()
1289            .project("simple/project")
1290            .import_url("https://test.invalid/path?some=foo")
1291            .build()
1292            .unwrap();
1293        api::ignore(endpoint).query(&client).unwrap();
1294    }
1295
1296    #[test]
1297    fn endpoint_public_builds() {
1298        let endpoint = ExpectedUrl::builder()
1299            .method(Method::PUT)
1300            .endpoint("projects/simple%2Fproject")
1301            .content_type("application/x-www-form-urlencoded")
1302            .body_str("public_builds=true")
1303            .build()
1304            .unwrap();
1305        let client = SingleTestClient::new_raw(endpoint, "");
1306
1307        let endpoint = EditProject::builder()
1308            .project("simple/project")
1309            .public_builds(true)
1310            .build()
1311            .unwrap();
1312        api::ignore(endpoint).query(&client).unwrap();
1313    }
1314
1315    #[test]
1316    fn endpoint_only_allow_merge_if_pipeline_succeeds() {
1317        let endpoint = ExpectedUrl::builder()
1318            .method(Method::PUT)
1319            .endpoint("projects/simple%2Fproject")
1320            .content_type("application/x-www-form-urlencoded")
1321            .body_str("only_allow_merge_if_pipeline_succeeds=false")
1322            .build()
1323            .unwrap();
1324        let client = SingleTestClient::new_raw(endpoint, "");
1325
1326        let endpoint = EditProject::builder()
1327            .project("simple/project")
1328            .only_allow_merge_if_pipeline_succeeds(false)
1329            .build()
1330            .unwrap();
1331        api::ignore(endpoint).query(&client).unwrap();
1332    }
1333
1334    #[test]
1335    fn endpoint_allow_merge_on_skipped_pipeline() {
1336        let endpoint = ExpectedUrl::builder()
1337            .method(Method::PUT)
1338            .endpoint("projects/simple%2Fproject")
1339            .content_type("application/x-www-form-urlencoded")
1340            .body_str("allow_merge_on_skipped_pipeline=false")
1341            .build()
1342            .unwrap();
1343        let client = SingleTestClient::new_raw(endpoint, "");
1344
1345        let endpoint = EditProject::builder()
1346            .project("simple/project")
1347            .allow_merge_on_skipped_pipeline(false)
1348            .build()
1349            .unwrap();
1350        api::ignore(endpoint).query(&client).unwrap();
1351    }
1352
1353    #[test]
1354    fn endpoint_only_allow_merge_if_all_discussions_are_resolved() {
1355        let endpoint = ExpectedUrl::builder()
1356            .method(Method::PUT)
1357            .endpoint("projects/simple%2Fproject")
1358            .content_type("application/x-www-form-urlencoded")
1359            .body_str("only_allow_merge_if_all_discussions_are_resolved=true")
1360            .build()
1361            .unwrap();
1362        let client = SingleTestClient::new_raw(endpoint, "");
1363
1364        let endpoint = EditProject::builder()
1365            .project("simple/project")
1366            .only_allow_merge_if_all_discussions_are_resolved(true)
1367            .build()
1368            .unwrap();
1369        api::ignore(endpoint).query(&client).unwrap();
1370    }
1371
1372    #[test]
1373    fn endpoint_only_allow_merge_if_all_status_checks_passed() {
1374        let endpoint = ExpectedUrl::builder()
1375            .method(Method::PUT)
1376            .endpoint("projects/simple%2Fproject")
1377            .content_type("application/x-www-form-urlencoded")
1378            .body_str("only_allow_merge_if_all_status_checks_passed=true")
1379            .build()
1380            .unwrap();
1381        let client = SingleTestClient::new_raw(endpoint, "");
1382
1383        let endpoint = EditProject::builder()
1384            .project("simple/project")
1385            .only_allow_merge_if_all_status_checks_passed(true)
1386            .build()
1387            .unwrap();
1388        api::ignore(endpoint).query(&client).unwrap();
1389    }
1390
1391    #[test]
1392    fn endpoint_merge_commit_template() {
1393        let endpoint = ExpectedUrl::builder()
1394            .method(Method::PUT)
1395            .endpoint("projects/simple%2Fproject")
1396            .content_type("application/x-www-form-urlencoded")
1397            .body_str("merge_commit_template=template")
1398            .build()
1399            .unwrap();
1400        let client = SingleTestClient::new_raw(endpoint, "");
1401
1402        let endpoint = EditProject::builder()
1403            .project("simple/project")
1404            .merge_commit_template("template")
1405            .build()
1406            .unwrap();
1407        api::ignore(endpoint).query(&client).unwrap();
1408    }
1409
1410    #[test]
1411    fn endpoint_squash_commit_template() {
1412        let endpoint = ExpectedUrl::builder()
1413            .method(Method::PUT)
1414            .endpoint("projects/simple%2Fproject")
1415            .content_type("application/x-www-form-urlencoded")
1416            .body_str("squash_commit_template=template")
1417            .build()
1418            .unwrap();
1419        let client = SingleTestClient::new_raw(endpoint, "");
1420
1421        let endpoint = EditProject::builder()
1422            .project("simple/project")
1423            .squash_commit_template("template")
1424            .build()
1425            .unwrap();
1426        api::ignore(endpoint).query(&client).unwrap();
1427    }
1428
1429    #[test]
1430    fn endpoint_issues_template() {
1431        let endpoint = ExpectedUrl::builder()
1432            .method(Method::PUT)
1433            .endpoint("projects/simple%2Fproject")
1434            .content_type("application/x-www-form-urlencoded")
1435            .body_str("issues_template=template")
1436            .build()
1437            .unwrap();
1438        let client = SingleTestClient::new_raw(endpoint, "");
1439
1440        let endpoint = EditProject::builder()
1441            .project("simple/project")
1442            .issues_template("template")
1443            .build()
1444            .unwrap();
1445        api::ignore(endpoint).query(&client).unwrap();
1446    }
1447
1448    #[test]
1449    fn endpoint_merge_requests_template() {
1450        let endpoint = ExpectedUrl::builder()
1451            .method(Method::PUT)
1452            .endpoint("projects/simple%2Fproject")
1453            .content_type("application/x-www-form-urlencoded")
1454            .body_str("merge_requests_template=template")
1455            .build()
1456            .unwrap();
1457        let client = SingleTestClient::new_raw(endpoint, "");
1458
1459        let endpoint = EditProject::builder()
1460            .project("simple/project")
1461            .merge_requests_template("template")
1462            .build()
1463            .unwrap();
1464        api::ignore(endpoint).query(&client).unwrap();
1465    }
1466
1467    #[test]
1468    fn endpoint_merge_method() {
1469        let endpoint = ExpectedUrl::builder()
1470            .method(Method::PUT)
1471            .endpoint("projects/simple%2Fproject")
1472            .content_type("application/x-www-form-urlencoded")
1473            .body_str("merge_method=ff")
1474            .build()
1475            .unwrap();
1476        let client = SingleTestClient::new_raw(endpoint, "");
1477
1478        let endpoint = EditProject::builder()
1479            .project("simple/project")
1480            .merge_method(MergeMethod::FastForward)
1481            .build()
1482            .unwrap();
1483        api::ignore(endpoint).query(&client).unwrap();
1484    }
1485
1486    #[test]
1487    fn endpoint_squash_option() {
1488        let endpoint = ExpectedUrl::builder()
1489            .method(Method::PUT)
1490            .endpoint("projects/simple%2Fproject")
1491            .content_type("application/x-www-form-urlencoded")
1492            .body_str("squash_option=never")
1493            .build()
1494            .unwrap();
1495        let client = SingleTestClient::new_raw(endpoint, "");
1496
1497        let endpoint = EditProject::builder()
1498            .project("simple/project")
1499            .squash_option(SquashOption::Never)
1500            .build()
1501            .unwrap();
1502        api::ignore(endpoint).query(&client).unwrap();
1503    }
1504
1505    #[test]
1506    fn endpoint_merge_pipelines_enabled() {
1507        let endpoint = ExpectedUrl::builder()
1508            .method(Method::PUT)
1509            .endpoint("projects/simple%2Fproject")
1510            .content_type("application/x-www-form-urlencoded")
1511            .body_str("merge_pipelines_enabled=true")
1512            .build()
1513            .unwrap();
1514        let client = SingleTestClient::new_raw(endpoint, "");
1515
1516        let endpoint = EditProject::builder()
1517            .project("simple/project")
1518            .merge_pipelines_enabled(true)
1519            .build()
1520            .unwrap();
1521        api::ignore(endpoint).query(&client).unwrap();
1522    }
1523
1524    #[test]
1525    fn endpoint_merge_trains_enabled() {
1526        let endpoint = ExpectedUrl::builder()
1527            .method(Method::PUT)
1528            .endpoint("projects/simple%2Fproject")
1529            .content_type("application/x-www-form-urlencoded")
1530            .body_str("merge_trains_enabled=true")
1531            .build()
1532            .unwrap();
1533        let client = SingleTestClient::new_raw(endpoint, "");
1534
1535        let endpoint = EditProject::builder()
1536            .project("simple/project")
1537            .merge_trains_enabled(true)
1538            .build()
1539            .unwrap();
1540        api::ignore(endpoint).query(&client).unwrap();
1541    }
1542
1543    #[test]
1544    fn endpoint_mr_default_target_self() {
1545        let endpoint = ExpectedUrl::builder()
1546            .method(Method::PUT)
1547            .endpoint("projects/simple%2Fproject")
1548            .content_type("application/x-www-form-urlencoded")
1549            .body_str("mr_default_target_self=true")
1550            .build()
1551            .unwrap();
1552        let client = SingleTestClient::new_raw(endpoint, "");
1553
1554        let endpoint = EditProject::builder()
1555            .project("simple/project")
1556            .mr_default_target_self(true)
1557            .build()
1558            .unwrap();
1559        api::ignore(endpoint).query(&client).unwrap();
1560    }
1561
1562    #[test]
1563    fn endpoint_autoclose_referenced_issues() {
1564        let endpoint = ExpectedUrl::builder()
1565            .method(Method::PUT)
1566            .endpoint("projects/simple%2Fproject")
1567            .content_type("application/x-www-form-urlencoded")
1568            .body_str("autoclose_referenced_issues=true")
1569            .build()
1570            .unwrap();
1571        let client = SingleTestClient::new_raw(endpoint, "");
1572
1573        let endpoint = EditProject::builder()
1574            .project("simple/project")
1575            .autoclose_referenced_issues(true)
1576            .build()
1577            .unwrap();
1578        api::ignore(endpoint).query(&client).unwrap();
1579    }
1580
1581    #[test]
1582    fn endpoint_suggestion_commit_message() {
1583        let endpoint = ExpectedUrl::builder()
1584            .method(Method::PUT)
1585            .endpoint("projects/simple%2Fproject")
1586            .content_type("application/x-www-form-urlencoded")
1587            .body_str("suggestion_commit_message=suggested+change")
1588            .build()
1589            .unwrap();
1590        let client = SingleTestClient::new_raw(endpoint, "");
1591
1592        let endpoint = EditProject::builder()
1593            .project("simple/project")
1594            .suggestion_commit_message("suggested change")
1595            .build()
1596            .unwrap();
1597        api::ignore(endpoint).query(&client).unwrap();
1598    }
1599
1600    #[test]
1601    fn endpoint_remove_source_branch_after_merge() {
1602        let endpoint = ExpectedUrl::builder()
1603            .method(Method::PUT)
1604            .endpoint("projects/simple%2Fproject")
1605            .content_type("application/x-www-form-urlencoded")
1606            .body_str("remove_source_branch_after_merge=true")
1607            .build()
1608            .unwrap();
1609        let client = SingleTestClient::new_raw(endpoint, "");
1610
1611        let endpoint = EditProject::builder()
1612            .project("simple/project")
1613            .remove_source_branch_after_merge(true)
1614            .build()
1615            .unwrap();
1616        api::ignore(endpoint).query(&client).unwrap();
1617    }
1618
1619    #[test]
1620    fn endpoint_prevent_merge_without_jira_issue() {
1621        let endpoint = ExpectedUrl::builder()
1622            .method(Method::PUT)
1623            .endpoint("projects/simple%2Fproject")
1624            .content_type("application/x-www-form-urlencoded")
1625            .body_str("prevent_merge_without_jira_issue=true")
1626            .build()
1627            .unwrap();
1628        let client = SingleTestClient::new_raw(endpoint, "");
1629
1630        let endpoint = EditProject::builder()
1631            .project("simple/project")
1632            .prevent_merge_without_jira_issue(true)
1633            .build()
1634            .unwrap();
1635        api::ignore(endpoint).query(&client).unwrap();
1636    }
1637
1638    #[test]
1639    fn endpoint_printing_merge_request_link_enabled() {
1640        let endpoint = ExpectedUrl::builder()
1641            .method(Method::PUT)
1642            .endpoint("projects/simple%2Fproject")
1643            .content_type("application/x-www-form-urlencoded")
1644            .body_str("printing_merge_request_link_enabled=true")
1645            .build()
1646            .unwrap();
1647        let client = SingleTestClient::new_raw(endpoint, "");
1648
1649        let endpoint = EditProject::builder()
1650            .project("simple/project")
1651            .printing_merge_request_link_enabled(true)
1652            .build()
1653            .unwrap();
1654        api::ignore(endpoint).query(&client).unwrap();
1655    }
1656
1657    #[test]
1658    fn endpoint_lfs_enabled() {
1659        let endpoint = ExpectedUrl::builder()
1660            .method(Method::PUT)
1661            .endpoint("projects/simple%2Fproject")
1662            .content_type("application/x-www-form-urlencoded")
1663            .body_str("lfs_enabled=false")
1664            .build()
1665            .unwrap();
1666        let client = SingleTestClient::new_raw(endpoint, "");
1667
1668        let endpoint = EditProject::builder()
1669            .project("simple/project")
1670            .lfs_enabled(false)
1671            .build()
1672            .unwrap();
1673        api::ignore(endpoint).query(&client).unwrap();
1674    }
1675
1676    #[test]
1677    fn endpoint_request_access_enabled() {
1678        let endpoint = ExpectedUrl::builder()
1679            .method(Method::PUT)
1680            .endpoint("projects/simple%2Fproject")
1681            .content_type("application/x-www-form-urlencoded")
1682            .body_str("request_access_enabled=true")
1683            .build()
1684            .unwrap();
1685        let client = SingleTestClient::new_raw(endpoint, "");
1686
1687        let endpoint = EditProject::builder()
1688            .project("simple/project")
1689            .request_access_enabled(true)
1690            .build()
1691            .unwrap();
1692        api::ignore(endpoint).query(&client).unwrap();
1693    }
1694
1695    #[test]
1696    fn endpoint_topics() {
1697        let endpoint = ExpectedUrl::builder()
1698            .method(Method::PUT)
1699            .endpoint("projects/simple%2Fproject")
1700            .content_type("application/x-www-form-urlencoded")
1701            .body_str(concat!("topics%5B%5D=topic1", "&topics%5B%5D=topic2"))
1702            .build()
1703            .unwrap();
1704        let client = SingleTestClient::new_raw(endpoint, "");
1705
1706        let endpoint = EditProject::builder()
1707            .project("simple/project")
1708            .topic("topic1")
1709            .topics(["topic1", "topic2"].iter().copied())
1710            .build()
1711            .unwrap();
1712        api::ignore(endpoint).query(&client).unwrap();
1713    }
1714
1715    #[test]
1716    fn endpoint_build_git_strategy() {
1717        let endpoint = ExpectedUrl::builder()
1718            .method(Method::PUT)
1719            .endpoint("projects/simple%2Fproject")
1720            .content_type("application/x-www-form-urlencoded")
1721            .body_str("build_git_strategy=fetch")
1722            .build()
1723            .unwrap();
1724        let client = SingleTestClient::new_raw(endpoint, "");
1725
1726        let endpoint = EditProject::builder()
1727            .project("simple/project")
1728            .build_git_strategy(BuildGitStrategy::Fetch)
1729            .build()
1730            .unwrap();
1731        api::ignore(endpoint).query(&client).unwrap();
1732    }
1733
1734    #[test]
1735    fn endpoint_build_timeout() {
1736        let endpoint = ExpectedUrl::builder()
1737            .method(Method::PUT)
1738            .endpoint("projects/simple%2Fproject")
1739            .content_type("application/x-www-form-urlencoded")
1740            .body_str("build_timeout=1")
1741            .build()
1742            .unwrap();
1743        let client = SingleTestClient::new_raw(endpoint, "");
1744
1745        let endpoint = EditProject::builder()
1746            .project("simple/project")
1747            .build_timeout(1)
1748            .build()
1749            .unwrap();
1750        api::ignore(endpoint).query(&client).unwrap();
1751    }
1752
1753    #[test]
1754    fn endpoint_auto_cancel_pending_pipelines() {
1755        let endpoint = ExpectedUrl::builder()
1756            .method(Method::PUT)
1757            .endpoint("projects/simple%2Fproject")
1758            .content_type("application/x-www-form-urlencoded")
1759            .body_str("auto_cancel_pending_pipelines=enabled")
1760            .build()
1761            .unwrap();
1762        let client = SingleTestClient::new_raw(endpoint, "");
1763
1764        let endpoint = EditProject::builder()
1765            .project("simple/project")
1766            .auto_cancel_pending_pipelines(EnableState::Enabled)
1767            .build()
1768            .unwrap();
1769        api::ignore(endpoint).query(&client).unwrap();
1770    }
1771
1772    #[test]
1773    fn endpoint_ci_config_path() {
1774        let endpoint = ExpectedUrl::builder()
1775            .method(Method::PUT)
1776            .endpoint("projects/simple%2Fproject")
1777            .content_type("application/x-www-form-urlencoded")
1778            .body_str("ci_config_path=.gitlab-ci.yaml")
1779            .build()
1780            .unwrap();
1781        let client = SingleTestClient::new_raw(endpoint, "");
1782
1783        let endpoint = EditProject::builder()
1784            .project("simple/project")
1785            .ci_config_path(".gitlab-ci.yaml")
1786            .build()
1787            .unwrap();
1788        api::ignore(endpoint).query(&client).unwrap();
1789    }
1790
1791    #[test]
1792    fn endpoint_ci_default_git_depth() {
1793        let endpoint = ExpectedUrl::builder()
1794            .method(Method::PUT)
1795            .endpoint("projects/simple%2Fproject")
1796            .content_type("application/x-www-form-urlencoded")
1797            .body_str("ci_default_git_depth=1")
1798            .build()
1799            .unwrap();
1800        let client = SingleTestClient::new_raw(endpoint, "");
1801
1802        let endpoint = EditProject::builder()
1803            .project("simple/project")
1804            .ci_default_git_depth(1)
1805            .build()
1806            .unwrap();
1807        api::ignore(endpoint).query(&client).unwrap();
1808    }
1809
1810    #[test]
1811    fn endpoint_ci_forward_deployment_enabled() {
1812        let endpoint = ExpectedUrl::builder()
1813            .method(Method::PUT)
1814            .endpoint("projects/simple%2Fproject")
1815            .content_type("application/x-www-form-urlencoded")
1816            .body_str("ci_forward_deployment_enabled=true")
1817            .build()
1818            .unwrap();
1819        let client = SingleTestClient::new_raw(endpoint, "");
1820
1821        let endpoint = EditProject::builder()
1822            .project("simple/project")
1823            .ci_forward_deployment_enabled(true)
1824            .build()
1825            .unwrap();
1826        api::ignore(endpoint).query(&client).unwrap();
1827    }
1828
1829    #[test]
1830    fn endpoint_auto_devops_enabled() {
1831        let endpoint = ExpectedUrl::builder()
1832            .method(Method::PUT)
1833            .endpoint("projects/simple%2Fproject")
1834            .content_type("application/x-www-form-urlencoded")
1835            .body_str("auto_devops_enabled=false")
1836            .build()
1837            .unwrap();
1838        let client = SingleTestClient::new_raw(endpoint, "");
1839
1840        let endpoint = EditProject::builder()
1841            .project("simple/project")
1842            .auto_devops_enabled(false)
1843            .build()
1844            .unwrap();
1845        api::ignore(endpoint).query(&client).unwrap();
1846    }
1847
1848    #[test]
1849    fn endpoint_auto_devops_deploy_strategy() {
1850        let endpoint = ExpectedUrl::builder()
1851            .method(Method::PUT)
1852            .endpoint("projects/simple%2Fproject")
1853            .content_type("application/x-www-form-urlencoded")
1854            .body_str("auto_devops_deploy_strategy=manual")
1855            .build()
1856            .unwrap();
1857        let client = SingleTestClient::new_raw(endpoint, "");
1858
1859        let endpoint = EditProject::builder()
1860            .project("simple/project")
1861            .auto_devops_deploy_strategy(AutoDevOpsDeployStrategy::Manual)
1862            .build()
1863            .unwrap();
1864        api::ignore(endpoint).query(&client).unwrap();
1865    }
1866
1867    #[test]
1868    fn endpoint_repository_storage() {
1869        let endpoint = ExpectedUrl::builder()
1870            .method(Method::PUT)
1871            .endpoint("projects/simple%2Fproject")
1872            .content_type("application/x-www-form-urlencoded")
1873            .body_str("repository_storage=shard1")
1874            .build()
1875            .unwrap();
1876        let client = SingleTestClient::new_raw(endpoint, "");
1877
1878        let endpoint = EditProject::builder()
1879            .project("simple/project")
1880            .repository_storage("shard1")
1881            .build()
1882            .unwrap();
1883        api::ignore(endpoint).query(&client).unwrap();
1884    }
1885
1886    #[test]
1887    fn endpoint_external_authorization_classification_label() {
1888        let endpoint = ExpectedUrl::builder()
1889            .method(Method::PUT)
1890            .endpoint("projects/simple%2Fproject")
1891            .content_type("application/x-www-form-urlencoded")
1892            .body_str("external_authorization_classification_label=external")
1893            .build()
1894            .unwrap();
1895        let client = SingleTestClient::new_raw(endpoint, "");
1896
1897        let endpoint = EditProject::builder()
1898            .project("simple/project")
1899            .external_authorization_classification_label("external")
1900            .build()
1901            .unwrap();
1902        api::ignore(endpoint).query(&client).unwrap();
1903    }
1904
1905    #[test]
1906    fn endpoint_mirror() {
1907        let endpoint = ExpectedUrl::builder()
1908            .method(Method::PUT)
1909            .endpoint("projects/simple%2Fproject")
1910            .content_type("application/x-www-form-urlencoded")
1911            .body_str("mirror=true")
1912            .build()
1913            .unwrap();
1914        let client = SingleTestClient::new_raw(endpoint, "");
1915
1916        let endpoint = EditProject::builder()
1917            .project("simple/project")
1918            .mirror(true)
1919            .build()
1920            .unwrap();
1921        api::ignore(endpoint).query(&client).unwrap();
1922    }
1923
1924    #[test]
1925    fn endpoint_mirror_trigger_builds() {
1926        let endpoint = ExpectedUrl::builder()
1927            .method(Method::PUT)
1928            .endpoint("projects/simple%2Fproject")
1929            .content_type("application/x-www-form-urlencoded")
1930            .body_str("mirror_trigger_builds=false")
1931            .build()
1932            .unwrap();
1933        let client = SingleTestClient::new_raw(endpoint, "");
1934
1935        let endpoint = EditProject::builder()
1936            .project("simple/project")
1937            .mirror_trigger_builds(false)
1938            .build()
1939            .unwrap();
1940        api::ignore(endpoint).query(&client).unwrap();
1941    }
1942
1943    #[test]
1944    fn endpoint_only_mirror_protected_branches() {
1945        let endpoint = ExpectedUrl::builder()
1946            .method(Method::PUT)
1947            .endpoint("projects/simple%2Fproject")
1948            .content_type("application/x-www-form-urlencoded")
1949            .body_str("only_mirror_protected_branches=false")
1950            .build()
1951            .unwrap();
1952        let client = SingleTestClient::new_raw(endpoint, "");
1953
1954        let endpoint = EditProject::builder()
1955            .project("simple/project")
1956            .only_mirror_protected_branches(false)
1957            .build()
1958            .unwrap();
1959        api::ignore(endpoint).query(&client).unwrap();
1960    }
1961
1962    #[test]
1963    fn endpoint_mirror_overwrites_diverged_branches() {
1964        let endpoint = ExpectedUrl::builder()
1965            .method(Method::PUT)
1966            .endpoint("projects/simple%2Fproject")
1967            .content_type("application/x-www-form-urlencoded")
1968            .body_str("mirror_overwrites_diverged_branches=false")
1969            .build()
1970            .unwrap();
1971        let client = SingleTestClient::new_raw(endpoint, "");
1972
1973        let endpoint = EditProject::builder()
1974            .project("simple/project")
1975            .mirror_overwrites_diverged_branches(false)
1976            .build()
1977            .unwrap();
1978        api::ignore(endpoint).query(&client).unwrap();
1979    }
1980
1981    #[test]
1982    fn endpoint_mirror_branch_regex() {
1983        let endpoint = ExpectedUrl::builder()
1984            .method(Method::PUT)
1985            .endpoint("projects/simple%2Fproject")
1986            .content_type("application/x-www-form-urlencoded")
1987            .body_str("mirror_branch_regex=main")
1988            .build()
1989            .unwrap();
1990        let client = SingleTestClient::new_raw(endpoint, "");
1991
1992        let endpoint = EditProject::builder()
1993            .project("simple/project")
1994            .mirror_branch_regex("main")
1995            .build()
1996            .unwrap();
1997        api::ignore(endpoint).query(&client).unwrap();
1998    }
1999
2000    #[test]
2001    fn endpoint_packages_enabled() {
2002        let endpoint = ExpectedUrl::builder()
2003            .method(Method::PUT)
2004            .endpoint("projects/simple%2Fproject")
2005            .content_type("application/x-www-form-urlencoded")
2006            .body_str("packages_enabled=false")
2007            .build()
2008            .unwrap();
2009        let client = SingleTestClient::new_raw(endpoint, "");
2010
2011        let endpoint = EditProject::builder()
2012            .project("simple/project")
2013            .packages_enabled(false)
2014            .build()
2015            .unwrap();
2016        api::ignore(endpoint).query(&client).unwrap();
2017    }
2018
2019    #[test]
2020    fn endpoint_group_runners_enabled() {
2021        let endpoint = ExpectedUrl::builder()
2022            .method(Method::PUT)
2023            .endpoint("projects/simple%2Fproject")
2024            .content_type("application/x-www-form-urlencoded")
2025            .body_str("group_runners_enabled=false")
2026            .build()
2027            .unwrap();
2028        let client = SingleTestClient::new_raw(endpoint, "");
2029
2030        let endpoint = EditProject::builder()
2031            .project("simple/project")
2032            .group_runners_enabled(false)
2033            .build()
2034            .unwrap();
2035        api::ignore(endpoint).query(&client).unwrap();
2036    }
2037
2038    #[test]
2039    fn endpoint_service_desk_enabled() {
2040        let endpoint = ExpectedUrl::builder()
2041            .method(Method::PUT)
2042            .endpoint("projects/simple%2Fproject")
2043            .content_type("application/x-www-form-urlencoded")
2044            .body_str("service_desk_enabled=false")
2045            .build()
2046            .unwrap();
2047        let client = SingleTestClient::new_raw(endpoint, "");
2048
2049        let endpoint = EditProject::builder()
2050            .project("simple/project")
2051            .service_desk_enabled(false)
2052            .build()
2053            .unwrap();
2054        api::ignore(endpoint).query(&client).unwrap();
2055    }
2056
2057    #[test]
2058    fn endpoint_keep_latest_artifact() {
2059        let endpoint = ExpectedUrl::builder()
2060            .method(Method::PUT)
2061            .endpoint("projects/simple%2Fproject")
2062            .content_type("application/x-www-form-urlencoded")
2063            .body_str("keep_latest_artifact=false")
2064            .build()
2065            .unwrap();
2066        let client = SingleTestClient::new_raw(endpoint, "");
2067
2068        let endpoint = EditProject::builder()
2069            .project("simple/project")
2070            .keep_latest_artifact(false)
2071            .build()
2072            .unwrap();
2073        api::ignore(endpoint).query(&client).unwrap();
2074    }
2075
2076    #[test]
2077    fn endpoint_ci_separated_caches() {
2078        let endpoint = ExpectedUrl::builder()
2079            .method(Method::PUT)
2080            .endpoint("projects/simple%2Fproject")
2081            .content_type("application/x-www-form-urlencoded")
2082            .body_str("ci_separated_caches=false")
2083            .build()
2084            .unwrap();
2085        let client = SingleTestClient::new_raw(endpoint, "");
2086
2087        let endpoint = EditProject::builder()
2088            .project("simple/project")
2089            .ci_separated_caches(false)
2090            .build()
2091            .unwrap();
2092        api::ignore(endpoint).query(&client).unwrap();
2093    }
2094
2095    #[test]
2096    fn endpoint_ci_allow_fork_pipelines_to_run_in_parent_project() {
2097        let endpoint = ExpectedUrl::builder()
2098            .method(Method::PUT)
2099            .endpoint("projects/simple%2Fproject")
2100            .content_type("application/x-www-form-urlencoded")
2101            .body_str("ci_allow_fork_pipelines_to_run_in_parent_project=false")
2102            .build()
2103            .unwrap();
2104        let client = SingleTestClient::new_raw(endpoint, "");
2105
2106        let endpoint = EditProject::builder()
2107            .project("simple/project")
2108            .ci_allow_fork_pipelines_to_run_in_parent_project(false)
2109            .build()
2110            .unwrap();
2111        api::ignore(endpoint).query(&client).unwrap();
2112    }
2113
2114    #[test]
2115    fn endpoint_enforce_auth_checks_on_uploads() {
2116        let endpoint = ExpectedUrl::builder()
2117            .method(Method::PUT)
2118            .endpoint("projects/simple%2Fproject")
2119            .content_type("application/x-www-form-urlencoded")
2120            .body_str("enforce_auth_checks_on_uploads=false")
2121            .build()
2122            .unwrap();
2123        let client = SingleTestClient::new_raw(endpoint, "");
2124
2125        let endpoint = EditProject::builder()
2126            .project("simple/project")
2127            .enforce_auth_checks_on_uploads(false)
2128            .build()
2129            .unwrap();
2130        api::ignore(endpoint).query(&client).unwrap();
2131    }
2132
2133    #[test]
2134    fn endpoint_issue_branch_template() {
2135        let endpoint = ExpectedUrl::builder()
2136            .method(Method::PUT)
2137            .endpoint("projects/simple%2Fproject")
2138            .content_type("application/x-www-form-urlencoded")
2139            .body_str("issue_branch_template=issue%2F%25d")
2140            .build()
2141            .unwrap();
2142        let client = SingleTestClient::new_raw(endpoint, "");
2143
2144        let endpoint = EditProject::builder()
2145            .project("simple/project")
2146            .issue_branch_template("issue/%d")
2147            .build()
2148            .unwrap();
2149        api::ignore(endpoint).query(&client).unwrap();
2150    }
2151
2152    #[test]
2153    fn endpoint_allow_pipeline_trigger_approve_deployment() {
2154        let endpoint = ExpectedUrl::builder()
2155            .method(Method::PUT)
2156            .endpoint("projects/simple%2Fproject")
2157            .content_type("application/x-www-form-urlencoded")
2158            .body_str("allow_pipeline_trigger_approve_deployment=false")
2159            .build()
2160            .unwrap();
2161        let client = SingleTestClient::new_raw(endpoint, "");
2162
2163        let endpoint = EditProject::builder()
2164            .project("simple/project")
2165            .allow_pipeline_trigger_approve_deployment(false)
2166            .build()
2167            .unwrap();
2168        api::ignore(endpoint).query(&client).unwrap();
2169    }
2170
2171    #[test]
2172    fn endpoint_ci_forward_deployment_rollback_allowed() {
2173        let endpoint = ExpectedUrl::builder()
2174            .method(Method::PUT)
2175            .endpoint("projects/simple%2Fproject")
2176            .content_type("application/x-www-form-urlencoded")
2177            .body_str("ci_forward_deployment_rollback_allowed=false")
2178            .build()
2179            .unwrap();
2180        let client = SingleTestClient::new_raw(endpoint, "");
2181
2182        let endpoint = EditProject::builder()
2183            .project("simple/project")
2184            .ci_forward_deployment_rollback_allowed(false)
2185            .build()
2186            .unwrap();
2187        api::ignore(endpoint).query(&client).unwrap();
2188    }
2189}