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