gitlab 4.4.0 → 4.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -2
- data/gitlab.gemspec +3 -1
- data/lib/gitlab/client.rb +1 -0
- data/lib/gitlab/client/merge_request_approvals.rb +110 -0
- data/lib/gitlab/client/projects.rb +19 -9
- data/lib/gitlab/error.rb +10 -3
- data/lib/gitlab/version.rb +1 -1
- metadata +5 -444
- data/.dockerignore +0 -6
- data/.rubocop.yml +0 -33
- data/.travis.yml +0 -13
- data/Dockerfile +0 -8
- data/docker-compose.yml +0 -19
- data/docker.env +0 -2
- data/spec/fixtures/access_request.json +0 -8
- data/spec/fixtures/access_requests.json +0 -18
- data/spec/fixtures/approved_access_request.json +0 -8
- data/spec/fixtures/board_list.json +0 -1
- data/spec/fixtures/board_lists.json +0 -1
- data/spec/fixtures/boards.json +0 -1
- data/spec/fixtures/branch.json +0 -1
- data/spec/fixtures/branch_delete.json +0 -3
- data/spec/fixtures/branches.json +0 -1
- data/spec/fixtures/build.json +0 -38
- data/spec/fixtures/build_artifacts.json +0 -0
- data/spec/fixtures/build_cancel.json +0 -24
- data/spec/fixtures/build_erase.json +0 -24
- data/spec/fixtures/build_retry.json +0 -24
- data/spec/fixtures/builds.json +0 -78
- data/spec/fixtures/builds_commits.json +0 -64
- data/spec/fixtures/compare_merge_request_diff.json +0 -31
- data/spec/fixtures/default_approved_access_request.json +0 -8
- data/spec/fixtures/deployment.json +0 -57
- data/spec/fixtures/deployments.json +0 -116
- data/spec/fixtures/empty.json +0 -0
- data/spec/fixtures/environment.json +0 -6
- data/spec/fixtures/environments.json +0 -14
- data/spec/fixtures/error_already_exists.json +0 -1
- data/spec/fixtures/error_project_not_found.json +0 -1
- data/spec/fixtures/get_repository_file.json +0 -1
- data/spec/fixtures/group.json +0 -60
- data/spec/fixtures/group_create.json +0 -1
- data/spec/fixtures/group_create_with_description.json +0 -1
- data/spec/fixtures/group_delete.json +0 -1
- data/spec/fixtures/group_edit.json +0 -14
- data/spec/fixtures/group_member.json +0 -1
- data/spec/fixtures/group_member_delete.json +0 -1
- data/spec/fixtures/group_member_edit.json +0 -1
- data/spec/fixtures/group_members.json +0 -1
- data/spec/fixtures/group_milestone.json +0 -1
- data/spec/fixtures/group_milestone_issues.json +0 -1
- data/spec/fixtures/group_milestone_merge_requests.json +0 -1
- data/spec/fixtures/group_milestones.json +0 -1
- data/spec/fixtures/group_projects.json +0 -44
- data/spec/fixtures/group_search.json +0 -2
- data/spec/fixtures/group_subgroups.json +0 -16
- data/spec/fixtures/groups.json +0 -2
- data/spec/fixtures/issue.json +0 -1
- data/spec/fixtures/issue_award_emoji.json +0 -16
- data/spec/fixtures/issue_award_emojis.json +0 -34
- data/spec/fixtures/issues.json +0 -1
- data/spec/fixtures/job.json +0 -43
- data/spec/fixtures/job_trace.json +0 -1
- data/spec/fixtures/jobs.json +0 -91
- data/spec/fixtures/key.json +0 -1
- data/spec/fixtures/keys.json +0 -1
- data/spec/fixtures/label.json +0 -1
- data/spec/fixtures/label_unsubscribe.json +0 -1
- data/spec/fixtures/labels.json +0 -1
- data/spec/fixtures/merge_request.json +0 -1
- data/spec/fixtures/merge_request_award_emoji.json +0 -16
- data/spec/fixtures/merge_request_award_emojis.json +0 -34
- data/spec/fixtures/merge_request_changes.json +0 -1
- data/spec/fixtures/merge_request_closes_issues.json +0 -1
- data/spec/fixtures/merge_request_comment.json +0 -1
- data/spec/fixtures/merge_request_comments.json +0 -1
- data/spec/fixtures/merge_request_commits.json +0 -1
- data/spec/fixtures/merge_request_discussion.json +0 -39
- data/spec/fixtures/merge_request_discussion_note.json +0 -33
- data/spec/fixtures/merge_request_discussions.json +0 -41
- data/spec/fixtures/merge_requests.json +0 -1
- data/spec/fixtures/milestone.json +0 -1
- data/spec/fixtures/milestone_issues.json +0 -1
- data/spec/fixtures/milestone_merge_requests.json +0 -1
- data/spec/fixtures/milestones.json +0 -1
- data/spec/fixtures/namespaces.json +0 -1
- data/spec/fixtures/note.json +0 -1
- data/spec/fixtures/note_award_emoji.json +0 -16
- data/spec/fixtures/note_award_emojis.json +0 -18
- data/spec/fixtures/notes.json +0 -1
- data/spec/fixtures/pipeline.json +0 -23
- data/spec/fixtures/pipeline_cancel.json +0 -23
- data/spec/fixtures/pipeline_create.json +0 -23
- data/spec/fixtures/pipeline_jobs.json +0 -91
- data/spec/fixtures/pipeline_retry.json +0 -23
- data/spec/fixtures/pipeline_schedule.json +0 -32
- data/spec/fixtures/pipeline_schedule_create.json +0 -21
- data/spec/fixtures/pipeline_schedule_update.json +0 -26
- data/spec/fixtures/pipeline_schedule_variable.json +0 -5
- data/spec/fixtures/pipeline_schedule_variable_update.json +0 -5
- data/spec/fixtures/pipeline_schedules.json +0 -22
- data/spec/fixtures/pipelines.json +0 -48
- data/spec/fixtures/project.json +0 -1
- data/spec/fixtures/project_commit.json +0 -13
- data/spec/fixtures/project_commit_comment.json +0 -1
- data/spec/fixtures/project_commit_comments.json +0 -1
- data/spec/fixtures/project_commit_create.json +0 -22
- data/spec/fixtures/project_commit_diff.json +0 -10
- data/spec/fixtures/project_commit_merge_requests.json +0 -1
- data/spec/fixtures/project_commit_status.json +0 -42
- data/spec/fixtures/project_commits.json +0 -1
- data/spec/fixtures/project_edit.json +0 -21
- data/spec/fixtures/project_events.json +0 -81
- data/spec/fixtures/project_for_user.json +0 -1
- data/spec/fixtures/project_fork.json +0 -50
- data/spec/fixtures/project_fork_link.json +0 -1
- data/spec/fixtures/project_forked_for_user.json +0 -50
- data/spec/fixtures/project_forks.json +0 -50
- data/spec/fixtures/project_hook.json +0 -1
- data/spec/fixtures/project_hooks.json +0 -1
- data/spec/fixtures/project_issues.json +0 -1
- data/spec/fixtures/project_key.json +0 -6
- data/spec/fixtures/project_keys.json +0 -6
- data/spec/fixtures/project_runner_enable.json +0 -7
- data/spec/fixtures/project_runners.json +0 -16
- data/spec/fixtures/project_search.json +0 -1
- data/spec/fixtures/project_star.json +0 -44
- data/spec/fixtures/project_tag_annotated.json +0 -1
- data/spec/fixtures/project_tag_lightweight.json +0 -1
- data/spec/fixtures/project_tags.json +0 -1
- data/spec/fixtures/project_unstar.json +0 -44
- data/spec/fixtures/project_update_commit_status.json +0 -20
- data/spec/fixtures/projects.json +0 -1
- data/spec/fixtures/push_rule.json +0 -1
- data/spec/fixtures/raw_file.json +0 -2
- data/spec/fixtures/release_create.json +0 -1
- data/spec/fixtures/release_update.json +0 -1
- data/spec/fixtures/repository_file.json +0 -1
- data/spec/fixtures/run_trigger.json +0 -1
- data/spec/fixtures/runner.json +0 -26
- data/spec/fixtures/runner_delete.json +0 -7
- data/spec/fixtures/runner_edit.json +0 -26
- data/spec/fixtures/runner_jobs.json +0 -63
- data/spec/fixtures/runners.json +0 -16
- data/spec/fixtures/runners_all.json +0 -30
- data/spec/fixtures/service.json +0 -1
- data/spec/fixtures/session.json +0 -1
- data/spec/fixtures/shell_history.json +0 -2
- data/spec/fixtures/sidekiq_compound_metrics.json +0 -36
- data/spec/fixtures/sidekiq_job_stats.json +0 -7
- data/spec/fixtures/sidekiq_process_metrics.json +0 -25
- data/spec/fixtures/sidekiq_queue_metrics.json +0 -8
- data/spec/fixtures/snippet.json +0 -1
- data/spec/fixtures/snippet_award_emoji.json +0 -16
- data/spec/fixtures/snippet_award_emojis.json +0 -34
- data/spec/fixtures/snippet_content.json +0 -3
- data/spec/fixtures/snippets.json +0 -1
- data/spec/fixtures/system_hook.json +0 -1
- data/spec/fixtures/system_hooks.json +0 -1
- data/spec/fixtures/tag.json +0 -1
- data/spec/fixtures/tag_create.json +0 -1
- data/spec/fixtures/tag_create_with_description.json +0 -1
- data/spec/fixtures/tag_delete.json +0 -1
- data/spec/fixtures/tags.json +0 -1
- data/spec/fixtures/team_member.json +0 -1
- data/spec/fixtures/team_members.json +0 -1
- data/spec/fixtures/todo.json +0 -73
- data/spec/fixtures/todos.json +0 -148
- data/spec/fixtures/tree.json +0 -1
- data/spec/fixtures/trigger.json +0 -10
- data/spec/fixtures/triggers.json +0 -12
- data/spec/fixtures/user.json +0 -1
- data/spec/fixtures/user_block_unblock.json +0 -1
- data/spec/fixtures/user_contribution_events.json +0 -101
- data/spec/fixtures/user_email.json +0 -1
- data/spec/fixtures/user_emails.json +0 -1
- data/spec/fixtures/user_events.json +0 -40
- data/spec/fixtures/user_projects.json +0 -153
- data/spec/fixtures/user_search.json +0 -1
- data/spec/fixtures/users.json +0 -1
- data/spec/fixtures/variable.json +0 -4
- data/spec/fixtures/variables.json +0 -10
- data/spec/gitlab/api_spec.rb +0 -11
- data/spec/gitlab/cli_helpers_spec.rb +0 -56
- data/spec/gitlab/cli_spec.rb +0 -119
- data/spec/gitlab/client/access_requests_spec.rb +0 -141
- data/spec/gitlab/client/award_emojis_spec.rb +0 -391
- data/spec/gitlab/client/boards_spec.rb +0 -94
- data/spec/gitlab/client/branches_spec.rb +0 -118
- data/spec/gitlab/client/build_variables_spec.rb +0 -169
- data/spec/gitlab/client/builds_spec.rb +0 -148
- data/spec/gitlab/client/client_spec.rb +0 -11
- data/spec/gitlab/client/commits_spec.rb +0 -190
- data/spec/gitlab/client/deployments_spec.rb +0 -38
- data/spec/gitlab/client/environments_spec.rb +0 -132
- data/spec/gitlab/client/events_spec.rb +0 -48
- data/spec/gitlab/client/group_milestones_spec.rb +0 -98
- data/spec/gitlab/client/groups_spec.rb +0 -246
- data/spec/gitlab/client/issues_spec.rb +0 -285
- data/spec/gitlab/client/jobs_spec.rb +0 -135
- data/spec/gitlab/client/keys_spec.rb +0 -19
- data/spec/gitlab/client/labels_spec.rb +0 -100
- data/spec/gitlab/client/merge_requests_spec.rb +0 -351
- data/spec/gitlab/client/milestones_spec.rb +0 -98
- data/spec/gitlab/client/namespaces_spec.rb +0 -22
- data/spec/gitlab/client/notes_spec.rb +0 -333
- data/spec/gitlab/client/pipeline_schedules_spec.rb +0 -158
- data/spec/gitlab/client/pipeline_triggers_spec.rb +0 -157
- data/spec/gitlab/client/pipelines_spec.rb +0 -95
- data/spec/gitlab/client/projects_spec.rb +0 -630
- data/spec/gitlab/client/repositories_spec.rb +0 -94
- data/spec/gitlab/client/repository_files_spec.rb +0 -95
- data/spec/gitlab/client/runners_spec.rb +0 -193
- data/spec/gitlab/client/services_spec.rb +0 -55
- data/spec/gitlab/client/sidekiq_spec.rb +0 -64
- data/spec/gitlab/client/snippets_spec.rb +0 -100
- data/spec/gitlab/client/system_hooks_spec.rb +0 -69
- data/spec/gitlab/client/tags_spec.rb +0 -152
- data/spec/gitlab/client/todos_spec.rb +0 -45
- data/spec/gitlab/client/users_spec.rb +0 -418
- data/spec/gitlab/error_spec.rb +0 -72
- data/spec/gitlab/file_response_spec.rb +0 -33
- data/spec/gitlab/help_spec.rb +0 -46
- data/spec/gitlab/objectified_hash_spec.rb +0 -48
- data/spec/gitlab/page_links_spec.rb +0 -16
- data/spec/gitlab/paginated_response_spec.rb +0 -60
- data/spec/gitlab/request_spec.rb +0 -73
- data/spec/gitlab/shell_history_spec.rb +0 -53
- data/spec/gitlab/shell_spec.rb +0 -80
- data/spec/gitlab_spec.rb +0 -96
- data/spec/spec_helper.rb +0 -39
@@ -1,158 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".pipeline_schedules" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/pipeline_schedules", "pipeline_schedules")
|
7
|
-
@pipeline_schedules = Gitlab.pipeline_schedules(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/pipeline_schedules")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a response of project's pipeline schedules" do
|
15
|
-
expect(@pipeline_schedules).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".pipeline_schedule" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/pipeline_schedules/5", "pipeline_schedule")
|
22
|
-
@pipeline_schedule = Gitlab.pipeline_schedule(3, 5)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/pipeline_schedules/5")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a response of project's pipeline schedules" do
|
30
|
-
expect(@pipeline_schedule).to be_a Gitlab::ObjectifiedHash
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
describe ".create_pipeline_schedule" do
|
35
|
-
before do
|
36
|
-
stub_post("/projects/3/pipeline_schedules", "pipeline_schedule_create")
|
37
|
-
@pipeline_schedule_create = Gitlab.create_pipeline_schedule(3)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "gets the correct resource" do
|
41
|
-
expect(a_post("/projects/3/pipeline_schedules")).to have_been_made
|
42
|
-
end
|
43
|
-
|
44
|
-
it "returns a single pipeline schedule" do
|
45
|
-
expect(@pipeline_schedule_create).to be_a Gitlab::ObjectifiedHash
|
46
|
-
end
|
47
|
-
|
48
|
-
it "returns information about a pipeline schedule" do
|
49
|
-
expect(@pipeline_schedule_create.owner.name).to eq("Administrator")
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
describe ".edit_pipeline_schedule" do
|
54
|
-
before do
|
55
|
-
stub_put("/projects/3/pipeline_schedules/13", "pipeline_schedule_update")
|
56
|
-
@pipeline_schedule_update = Gitlab.edit_pipeline_schedule(3, 13)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "gets the correct resource" do
|
60
|
-
expect(a_put("/projects/3/pipeline_schedules/13")).to have_been_made
|
61
|
-
end
|
62
|
-
|
63
|
-
it "returns a single pipeline schedule" do
|
64
|
-
expect(@pipeline_schedule_update).to be_a Gitlab::ObjectifiedHash
|
65
|
-
end
|
66
|
-
|
67
|
-
it "returns information about a pipeline schedule" do
|
68
|
-
expect(@pipeline_schedule_update.owner.name).to eq("Administrator")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe ".pipeline_schedule_take_ownership" do
|
73
|
-
before do
|
74
|
-
stub_post("/projects/3/pipeline_schedules/13/take_ownership", "pipeline_schedule")
|
75
|
-
@pipeline_schedule = Gitlab.pipeline_schedule_take_ownership(3, 13)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "gets the correct resource" do
|
79
|
-
expect(a_post("/projects/3/pipeline_schedules/13/take_ownership")).to have_been_made
|
80
|
-
end
|
81
|
-
|
82
|
-
it "returns information about the pipeline schedule" do
|
83
|
-
expect(@pipeline_schedule.created_at).to eq("2017-05-19T13:31:08.849Z")
|
84
|
-
expect(@pipeline_schedule.description).to eq("Test schedule pipeline")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe ".delete_pipeline_schedule" do
|
89
|
-
before do
|
90
|
-
stub_delete("/projects/3/pipeline_schedules/13", "pipeline_schedule")
|
91
|
-
@pipeline_schedule = Gitlab.delete_pipeline_schedule(3,13)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "gets the correct resource" do
|
95
|
-
expect(a_delete("/projects/3/pipeline_schedules/13")).to have_been_made
|
96
|
-
end
|
97
|
-
|
98
|
-
it "returns a single pipeline" do
|
99
|
-
expect(@pipeline_schedule).to be_a Gitlab::ObjectifiedHash
|
100
|
-
end
|
101
|
-
|
102
|
-
it "returns information about the deleted pipeline" do
|
103
|
-
# expect(@pipeline_schedule.id).to eq(13)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
describe ".create_pipeline_schedule_variable" do
|
108
|
-
before do
|
109
|
-
stub_post("/projects/3/pipeline_schedules/13/variables?key=NEW%20VARIABLE&value=new%20value", "pipeline_schedule_variable")
|
110
|
-
@pipeline_schedule_variable = Gitlab.create_pipeline_schedule_variable(3, 13, {
|
111
|
-
key: "NEW VARIABLE",
|
112
|
-
value: "new value"
|
113
|
-
})
|
114
|
-
end
|
115
|
-
|
116
|
-
it "gets the correct resource" do
|
117
|
-
expect(a_post("/projects/3/pipeline_schedules/13/variables?key=NEW%20VARIABLE&value=new%20value")).to have_been_made
|
118
|
-
end
|
119
|
-
|
120
|
-
it "returns a single variable" do
|
121
|
-
expect(@pipeline_schedule_variable).to be_a Gitlab::ObjectifiedHash
|
122
|
-
end
|
123
|
-
|
124
|
-
it "returns the created variable" do
|
125
|
-
expect(@pipeline_schedule_variable.value).to eq("new value")
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
describe ".edit_pipeline_schedule_variable" do
|
130
|
-
before do
|
131
|
-
stub_put("/projects/3/pipeline_schedules/13/variables/NEW%20VARIABLE?value=update%20value", "pipeline_schedule_variable_update")
|
132
|
-
@pipeline_schedule_variable = Gitlab.edit_pipeline_schedule_variable(3, 13, "NEW VARIABLE", { value: "update value" })
|
133
|
-
end
|
134
|
-
|
135
|
-
it "returns a single variable" do
|
136
|
-
expect(@pipeline_schedule_variable).to be_a Gitlab::ObjectifiedHash
|
137
|
-
end
|
138
|
-
|
139
|
-
it "has the updated value" do
|
140
|
-
expect(@pipeline_schedule_variable.value).to eq("update value")
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
describe ".delete_pipeline_schedule_variable" do
|
145
|
-
before do
|
146
|
-
stub_delete("/projects/3/pipeline_schedules/13/variables/NEW%20VARIABLE", "pipeline_schedule_variable")
|
147
|
-
@pipeline_schedule_variable = Gitlab.delete_pipeline_schedule_variable(3, 13, "NEW VARIABLE")
|
148
|
-
end
|
149
|
-
|
150
|
-
it "returns a single variable" do
|
151
|
-
expect(@pipeline_schedule_variable).to be_a Gitlab::ObjectifiedHash
|
152
|
-
end
|
153
|
-
|
154
|
-
it "has the value of the deleted variable" do
|
155
|
-
expect(@pipeline_schedule_variable.value).to eq("new value")
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
@@ -1,157 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
it { is_expected.to respond_to :delete_trigger }
|
5
|
-
|
6
|
-
describe ".triggers" do
|
7
|
-
before do
|
8
|
-
stub_get("/projects/3/triggers", "triggers")
|
9
|
-
@triggers = Gitlab.triggers(3)
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets the correct resource" do
|
13
|
-
expect(a_get("/projects/3/triggers")).to have_been_made
|
14
|
-
end
|
15
|
-
|
16
|
-
it "returns an array of project's triggers" do
|
17
|
-
expect(@triggers).to be_a Gitlab::PaginatedResponse
|
18
|
-
expect(@triggers.first.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
describe ".trigger" do
|
23
|
-
before do
|
24
|
-
stub_get("/projects/3/triggers/10", "trigger")
|
25
|
-
@trigger = Gitlab.trigger(3, 10)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "gets the correct resource" do
|
29
|
-
expect(a_get("/projects/3/triggers/10")).to have_been_made
|
30
|
-
end
|
31
|
-
|
32
|
-
it "returns information about a trigger" do
|
33
|
-
expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
|
34
|
-
expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe ".create_trigger" do
|
39
|
-
before do
|
40
|
-
stub_post("/projects/3/triggers", "trigger")
|
41
|
-
@trigger = Gitlab.create_trigger(3, "my description")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "gets the correct resource" do
|
45
|
-
expect(a_post("/projects/3/triggers").
|
46
|
-
with(body: { description: "my description" })).to have_been_made
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns information about a new trigger" do
|
50
|
-
expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
|
51
|
-
expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
describe ".update_trigger" do
|
56
|
-
before do
|
57
|
-
stub_put("/projects/3/triggers/1", "trigger")
|
58
|
-
@trigger = Gitlab.update_trigger(3, 1, description: "my description")
|
59
|
-
end
|
60
|
-
|
61
|
-
it "gets the correct resource" do
|
62
|
-
expect(a_put("/projects/3/triggers/1").
|
63
|
-
with(body: { description: "my description" })).to have_been_made
|
64
|
-
end
|
65
|
-
|
66
|
-
it "returns information about the trigger" do
|
67
|
-
expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
|
68
|
-
expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe ".trigger_take_ownership" do
|
73
|
-
before do
|
74
|
-
stub_post("/projects/3/triggers/1/take_ownership", "trigger")
|
75
|
-
@trigger = Gitlab.trigger_take_ownership(3, 1)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "gets the correct resource" do
|
79
|
-
expect(a_post("/projects/3/triggers/1/take_ownership")).to have_been_made
|
80
|
-
end
|
81
|
-
|
82
|
-
it "returns information about the trigger" do
|
83
|
-
expect(@trigger.created_at).to eq("2016-01-07T09:53:58.235Z")
|
84
|
-
expect(@trigger.token).to eq("6d056f63e50fe6f8c5f8f4aa10edb7")
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
describe ".remove_trigger" do
|
89
|
-
before do
|
90
|
-
stub_delete("/projects/3/triggers/10", "empty")
|
91
|
-
@trigger = Gitlab.remove_trigger(3, 10)
|
92
|
-
end
|
93
|
-
|
94
|
-
it "gets the correct resource" do
|
95
|
-
expect(a_delete("/projects/3/triggers/10")).to have_been_made
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
describe ".run_trigger" do
|
100
|
-
before do
|
101
|
-
stub_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline").
|
102
|
-
to_return(body: load_fixture("run_trigger"), status: 200)
|
103
|
-
end
|
104
|
-
|
105
|
-
context "when private_token is not set" do
|
106
|
-
before do
|
107
|
-
Gitlab.private_token = nil
|
108
|
-
end
|
109
|
-
|
110
|
-
it "does not raise Error::MissingCredentials" do
|
111
|
-
expect { Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10}) }.to_not raise_error
|
112
|
-
end
|
113
|
-
|
114
|
-
after do
|
115
|
-
Gitlab.private_token = 'secret'
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context "without variables" do
|
120
|
-
before do
|
121
|
-
@trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master")
|
122
|
-
end
|
123
|
-
|
124
|
-
it "gets the correct resource" do
|
125
|
-
expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline").
|
126
|
-
with(body: {
|
127
|
-
token: "7b9148c158980bbd9bcea92c17522d",
|
128
|
-
ref: "master"
|
129
|
-
})).to have_been_made
|
130
|
-
end
|
131
|
-
|
132
|
-
it "returns information about the triggered build" do
|
133
|
-
expect(@trigger.id).to eq(8)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context "with variables" do
|
138
|
-
before do
|
139
|
-
@trigger = Gitlab.run_trigger(3, "7b9148c158980bbd9bcea92c17522d", "master", {a: 10})
|
140
|
-
end
|
141
|
-
|
142
|
-
it "gets the correct resource" do
|
143
|
-
expect(a_request(:post, "#{Gitlab.endpoint}/projects/3/trigger/pipeline").
|
144
|
-
with(body: {
|
145
|
-
token: "7b9148c158980bbd9bcea92c17522d",
|
146
|
-
ref: "master",
|
147
|
-
variables: {a: "10"}
|
148
|
-
})).to have_been_made
|
149
|
-
end
|
150
|
-
|
151
|
-
it "returns information about the triggered build" do
|
152
|
-
expect(@trigger.id).to eq(8)
|
153
|
-
expect(@trigger.variables.a).to eq("10")
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
describe ".pipelines" do
|
5
|
-
before do
|
6
|
-
stub_get("/projects/3/pipelines", "pipelines")
|
7
|
-
@pipelines = Gitlab.pipelines(3)
|
8
|
-
end
|
9
|
-
|
10
|
-
it "gets the correct resource" do
|
11
|
-
expect(a_get("/projects/3/pipelines")).to have_been_made
|
12
|
-
end
|
13
|
-
|
14
|
-
it "returns a paginated response of project's pipelines" do
|
15
|
-
expect(@pipelines).to be_a Gitlab::PaginatedResponse
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe ".pipeline" do
|
20
|
-
before do
|
21
|
-
stub_get("/projects/3/pipelines/46", "pipeline")
|
22
|
-
@pipeline = Gitlab.pipeline(3, 46)
|
23
|
-
end
|
24
|
-
|
25
|
-
it "gets the correct resource" do
|
26
|
-
expect(a_get("/projects/3/pipelines/46")).to have_been_made
|
27
|
-
end
|
28
|
-
|
29
|
-
it "returns a single pipeline" do
|
30
|
-
expect(@pipeline).to be_a Gitlab::ObjectifiedHash
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns information about a pipeline" do
|
34
|
-
expect(@pipeline.id).to eq(46)
|
35
|
-
expect(@pipeline.user.name).to eq("Administrator")
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
describe ".create_pipeline" do
|
40
|
-
before do
|
41
|
-
stub_post("/projects/3/pipeline?ref=master", "pipeline_create")
|
42
|
-
@pipeline_create = Gitlab.create_pipeline(3, 'master')
|
43
|
-
end
|
44
|
-
|
45
|
-
it "gets the correct resource" do
|
46
|
-
expect(a_post("/projects/3/pipeline?ref=master")).to have_been_made
|
47
|
-
end
|
48
|
-
|
49
|
-
it "returns a single pipeline" do
|
50
|
-
expect(@pipeline_create).to be_a Gitlab::ObjectifiedHash
|
51
|
-
end
|
52
|
-
|
53
|
-
it "returns information about a pipeline" do
|
54
|
-
expect(@pipeline_create.user.name).to eq("Administrator")
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe ".cancel_pipeline" do
|
59
|
-
before do
|
60
|
-
stub_post("/projects/3/pipelines/46/cancel", "pipeline_cancel")
|
61
|
-
@pipeline_cancel = Gitlab.cancel_pipeline(3, 46)
|
62
|
-
end
|
63
|
-
|
64
|
-
it "gets the correct resource" do
|
65
|
-
expect(a_post("/projects/3/pipelines/46/cancel")).to have_been_made
|
66
|
-
end
|
67
|
-
|
68
|
-
it "returns a single pipeline" do
|
69
|
-
expect(@pipeline_cancel).to be_a Gitlab::ObjectifiedHash
|
70
|
-
end
|
71
|
-
|
72
|
-
it "returns information about a pipeline" do
|
73
|
-
expect(@pipeline_cancel.user.name).to eq("Administrator")
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe ".retry_pipeline" do
|
78
|
-
before do
|
79
|
-
stub_post("/projects/3/pipelines/46/retry", "pipeline_retry")
|
80
|
-
@pipeline_retry = Gitlab.retry_pipeline(3, 46)
|
81
|
-
end
|
82
|
-
|
83
|
-
it "gets the correct resource" do
|
84
|
-
expect(a_post("/projects/3/pipelines/46/retry")).to have_been_made
|
85
|
-
end
|
86
|
-
|
87
|
-
it "returns a single pipeline" do
|
88
|
-
expect(@pipeline_retry).to be_a Gitlab::ObjectifiedHash
|
89
|
-
end
|
90
|
-
|
91
|
-
it "returns information about a pipeline" do
|
92
|
-
expect(@pipeline_retry.user.name).to eq("Administrator")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,630 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab::Client do
|
4
|
-
it { is_expected.to respond_to :search_projects }
|
5
|
-
|
6
|
-
describe ".projects" do
|
7
|
-
before do
|
8
|
-
stub_get("/projects", "projects")
|
9
|
-
@projects = Gitlab.projects
|
10
|
-
end
|
11
|
-
|
12
|
-
it "gets the correct resource" do
|
13
|
-
expect(a_get("/projects")).to have_been_made
|
14
|
-
end
|
15
|
-
|
16
|
-
it "returns a paginated response of projects" do
|
17
|
-
expect(@projects).to be_a Gitlab::PaginatedResponse
|
18
|
-
expect(@projects.first.name).to eq("Brute")
|
19
|
-
expect(@projects.first.owner.name).to eq("John Smith")
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
describe ".project_search" do
|
24
|
-
before do
|
25
|
-
stub_get("/projects?search=Gitlab", "project_search")
|
26
|
-
@project_search = Gitlab.project_search("Gitlab")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "gets the correct resource" do
|
30
|
-
expect(a_get("/projects?search=Gitlab")).to have_been_made
|
31
|
-
end
|
32
|
-
|
33
|
-
it "returns a paginated response of projects found" do
|
34
|
-
expect(@project_search).to be_a Gitlab::PaginatedResponse
|
35
|
-
expect(@project_search.first.name).to eq("Gitlab")
|
36
|
-
expect(@project_search.first.owner.name).to eq("John Smith")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
describe ".project" do
|
41
|
-
before do
|
42
|
-
stub_get("/projects/3", "project")
|
43
|
-
@project = Gitlab.project(3)
|
44
|
-
end
|
45
|
-
|
46
|
-
it "gets the correct resource" do
|
47
|
-
expect(a_get("/projects/3")).to have_been_made
|
48
|
-
end
|
49
|
-
|
50
|
-
it "returns information about a project" do
|
51
|
-
expect(@project.name).to eq("Gitlab")
|
52
|
-
expect(@project.owner.name).to eq("John Smith")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe ".create_project" do
|
57
|
-
before do
|
58
|
-
stub_post("/projects", "project")
|
59
|
-
@project = Gitlab.create_project('Gitlab')
|
60
|
-
end
|
61
|
-
|
62
|
-
it "gets the correct resource" do
|
63
|
-
expect(a_post("/projects")).to have_been_made
|
64
|
-
end
|
65
|
-
|
66
|
-
it "returns information about a created project" do
|
67
|
-
expect(@project.name).to eq("Gitlab")
|
68
|
-
expect(@project.owner.name).to eq("John Smith")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe ".create_project for user" do
|
73
|
-
before do
|
74
|
-
stub_post("/users", "user")
|
75
|
-
@owner = Gitlab.create_user("john@example.com", "pass", name: 'John Owner')
|
76
|
-
stub_post("/projects/user/#{@owner.id}", "project_for_user")
|
77
|
-
@project = Gitlab.create_project('Brute', user_id: @owner.id)
|
78
|
-
end
|
79
|
-
|
80
|
-
it "returns information about a created project" do
|
81
|
-
expect(@project.name).to eq("Brute")
|
82
|
-
expect(@project.owner.name).to eq("John Owner")
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
describe ".delete_project" do
|
87
|
-
before do
|
88
|
-
stub_delete("/projects/Gitlab", "project")
|
89
|
-
@project = Gitlab.delete_project('Gitlab')
|
90
|
-
end
|
91
|
-
|
92
|
-
it "gets the correct resource" do
|
93
|
-
expect(a_delete("/projects/Gitlab")).to have_been_made
|
94
|
-
end
|
95
|
-
|
96
|
-
it "returns information about a deleted project" do
|
97
|
-
expect(@project.name).to eq("Gitlab")
|
98
|
-
expect(@project.owner.name).to eq("John Smith")
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe ".create_fork" do
|
103
|
-
context "without sudo option" do
|
104
|
-
before do
|
105
|
-
stub_post("/projects/3/fork", "project_fork")
|
106
|
-
@project = Gitlab.create_fork(3)
|
107
|
-
end
|
108
|
-
|
109
|
-
it "posts to the correct resource" do
|
110
|
-
expect(a_post("/projects/3/fork")).to have_been_made
|
111
|
-
end
|
112
|
-
|
113
|
-
it "returns information about the forked project" do
|
114
|
-
expect(@project.forked_from_project.id).to eq(3)
|
115
|
-
expect(@project.id).to eq(20)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context "with the sudo option" do
|
120
|
-
before do
|
121
|
-
stub_post("/projects/3/fork", "project_forked_for_user")
|
122
|
-
@sudoed_username = 'jack.smith'
|
123
|
-
@project = Gitlab.create_fork(3, sudo: @sudoed_username)
|
124
|
-
end
|
125
|
-
|
126
|
-
it "posts to the correct resource" do
|
127
|
-
expect(a_post("/projects/3/fork")).to have_been_made
|
128
|
-
end
|
129
|
-
|
130
|
-
it "returns information about the forked project" do
|
131
|
-
expect(@project.forked_from_project.id).to eq(3)
|
132
|
-
expect(@project.id).to eq(20)
|
133
|
-
expect(@project.owner.username).to eq(@sudoed_username)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
describe ".project_forks" do
|
139
|
-
before do
|
140
|
-
stub_get("/projects/3/forks", "project_forks")
|
141
|
-
@project_forks = Gitlab.project_forks(3)
|
142
|
-
end
|
143
|
-
|
144
|
-
it "gets the correct resource" do
|
145
|
-
expect(a_get("/projects/3/forks")).to have_been_made
|
146
|
-
end
|
147
|
-
|
148
|
-
it "returns a paginated response of projects found" do
|
149
|
-
expect(@project_forks).to be_a Gitlab::PaginatedResponse
|
150
|
-
expect(@project_forks.first.name).to eq("gitlab")
|
151
|
-
expect(@project_forks.first.owner.name).to eq("Administrator")
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe ".team_members" do
|
156
|
-
before do
|
157
|
-
stub_get("/projects/3/members", "team_members")
|
158
|
-
@team_members = Gitlab.team_members(3)
|
159
|
-
end
|
160
|
-
|
161
|
-
it "gets the correct resource" do
|
162
|
-
expect(a_get("/projects/3/members")).to have_been_made
|
163
|
-
end
|
164
|
-
|
165
|
-
it "returns a paginated response of team members" do
|
166
|
-
expect(@team_members).to be_a Gitlab::PaginatedResponse
|
167
|
-
expect(@team_members.first.name).to eq("John Smith")
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
describe ".team_member" do
|
172
|
-
before do
|
173
|
-
stub_get("/projects/3/members/1", "team_member")
|
174
|
-
@team_member = Gitlab.team_member(3, 1)
|
175
|
-
end
|
176
|
-
|
177
|
-
it "gets the correct resource" do
|
178
|
-
expect(a_get("/projects/3/members/1")).to have_been_made
|
179
|
-
end
|
180
|
-
|
181
|
-
it "returns information about a team member" do
|
182
|
-
expect(@team_member.name).to eq("John Smith")
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
describe ".add_team_member" do
|
187
|
-
before do
|
188
|
-
stub_post("/projects/3/members", "team_member")
|
189
|
-
@team_member = Gitlab.add_team_member(3, 1, 40)
|
190
|
-
end
|
191
|
-
|
192
|
-
it "gets the correct resource" do
|
193
|
-
expect(a_post("/projects/3/members").
|
194
|
-
with(body: { user_id: '1', access_level: '40' })).to have_been_made
|
195
|
-
end
|
196
|
-
|
197
|
-
it "returns information about an added team member" do
|
198
|
-
expect(@team_member.name).to eq("John Smith")
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
describe ".edit_team_member" do
|
203
|
-
before do
|
204
|
-
stub_put("/projects/3/members/1", "team_member")
|
205
|
-
@team_member = Gitlab.edit_team_member(3, 1, 40)
|
206
|
-
end
|
207
|
-
|
208
|
-
it "gets the correct resource" do
|
209
|
-
expect(a_put("/projects/3/members/1").
|
210
|
-
with(body: { access_level: '40' })).to have_been_made
|
211
|
-
end
|
212
|
-
|
213
|
-
it "returns information about an edited team member" do
|
214
|
-
expect(@team_member.name).to eq("John Smith")
|
215
|
-
end
|
216
|
-
end
|
217
|
-
|
218
|
-
describe ".remove_team_member" do
|
219
|
-
before do
|
220
|
-
stub_delete("/projects/3/members/1", "team_member")
|
221
|
-
@team_member = Gitlab.remove_team_member(3, 1)
|
222
|
-
end
|
223
|
-
|
224
|
-
it "gets the correct resource" do
|
225
|
-
expect(a_delete("/projects/3/members/1")).to have_been_made
|
226
|
-
end
|
227
|
-
|
228
|
-
it "returns information about a removed team member" do
|
229
|
-
expect(@team_member.name).to eq("John Smith")
|
230
|
-
end
|
231
|
-
end
|
232
|
-
|
233
|
-
describe ".project_hooks" do
|
234
|
-
before do
|
235
|
-
stub_get("/projects/1/hooks", "project_hooks")
|
236
|
-
@hooks = Gitlab.project_hooks(1)
|
237
|
-
end
|
238
|
-
|
239
|
-
it "gets the correct resource" do
|
240
|
-
expect(a_get("/projects/1/hooks")).to have_been_made
|
241
|
-
end
|
242
|
-
|
243
|
-
it "returns a paginated response of hooks" do
|
244
|
-
expect(@hooks).to be_a Gitlab::PaginatedResponse
|
245
|
-
expect(@hooks.first.url).to eq("https://api.example.net/v1/webhooks/ci")
|
246
|
-
end
|
247
|
-
end
|
248
|
-
|
249
|
-
describe ".project_hook" do
|
250
|
-
before do
|
251
|
-
stub_get("/projects/1/hooks/1", "project_hook")
|
252
|
-
@hook = Gitlab.project_hook(1, 1)
|
253
|
-
end
|
254
|
-
|
255
|
-
it "gets the correct resource" do
|
256
|
-
expect(a_get("/projects/1/hooks/1")).to have_been_made
|
257
|
-
end
|
258
|
-
|
259
|
-
it "returns information about a hook" do
|
260
|
-
expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
|
261
|
-
end
|
262
|
-
end
|
263
|
-
|
264
|
-
describe ".add_project_hook" do
|
265
|
-
context "without specified events" do
|
266
|
-
before do
|
267
|
-
stub_post("/projects/1/hooks", "project_hook")
|
268
|
-
@hook = Gitlab.add_project_hook(1, "https://api.example.net/v1/webhooks/ci")
|
269
|
-
end
|
270
|
-
|
271
|
-
it "gets the correct resource" do
|
272
|
-
body = { url: "https://api.example.net/v1/webhooks/ci" }
|
273
|
-
expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made
|
274
|
-
end
|
275
|
-
|
276
|
-
it "returns information about an added hook" do
|
277
|
-
expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
context "with specified events" do
|
282
|
-
before do
|
283
|
-
stub_post("/projects/1/hooks", "project_hook")
|
284
|
-
@hook = Gitlab.add_project_hook(1, "https://api.example.net/v1/webhooks/ci", push_events: true, merge_requests_events: true)
|
285
|
-
end
|
286
|
-
|
287
|
-
it "gets the correct resource" do
|
288
|
-
body = { url: "https://api.example.net/v1/webhooks/ci", push_events: "true", merge_requests_events: "true" }
|
289
|
-
expect(a_post("/projects/1/hooks").with(body: body)).to have_been_made
|
290
|
-
end
|
291
|
-
|
292
|
-
it "returns information about an added hook" do
|
293
|
-
expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
|
294
|
-
end
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
describe ".edit_project_hook" do
|
299
|
-
before do
|
300
|
-
stub_put("/projects/1/hooks/1", "project_hook")
|
301
|
-
@hook = Gitlab.edit_project_hook(1, 1, "https://api.example.net/v1/webhooks/ci")
|
302
|
-
end
|
303
|
-
|
304
|
-
it "gets the correct resource" do
|
305
|
-
body = { url: "https://api.example.net/v1/webhooks/ci" }
|
306
|
-
expect(a_put("/projects/1/hooks/1").with(body: body)).to have_been_made
|
307
|
-
end
|
308
|
-
|
309
|
-
it "returns information about an edited hook" do
|
310
|
-
expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
|
311
|
-
end
|
312
|
-
end
|
313
|
-
|
314
|
-
describe ".edit_project" do
|
315
|
-
context "using project ID" do
|
316
|
-
before do
|
317
|
-
stub_put("/projects/3", "project_edit").with(body: { name: "Gitlab-edit" })
|
318
|
-
@edited_project = Gitlab.edit_project(3, name: "Gitlab-edit")
|
319
|
-
end
|
320
|
-
|
321
|
-
it "gets the correct resource" do
|
322
|
-
expect(a_put("/projects/3").with(body: { name: "Gitlab-edit" })).to have_been_made
|
323
|
-
end
|
324
|
-
|
325
|
-
it "returns information about an edited project" do
|
326
|
-
expect(@edited_project.name).to eq("Gitlab-edit")
|
327
|
-
end
|
328
|
-
end
|
329
|
-
|
330
|
-
context "using namespaced project path" do
|
331
|
-
it "encodes the path properly" do
|
332
|
-
stub = stub_put("/projects/namespace%2Fpath", "project_edit").with(body: { name: "Gitlab-edit" })
|
333
|
-
Gitlab.edit_project('namespace/path', name: "Gitlab-edit")
|
334
|
-
expect(stub).to have_been_requested
|
335
|
-
end
|
336
|
-
end
|
337
|
-
end
|
338
|
-
|
339
|
-
describe ".delete_project_hook" do
|
340
|
-
context "when empty response" do
|
341
|
-
before do
|
342
|
-
stub_request(:delete, "#{Gitlab.endpoint}/projects/1/hooks/1").
|
343
|
-
with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
|
344
|
-
to_return(body: '')
|
345
|
-
@hook = Gitlab.delete_project_hook(1, 1)
|
346
|
-
end
|
347
|
-
|
348
|
-
it "gets the correct resource" do
|
349
|
-
expect(a_delete("/projects/1/hooks/1")).to have_been_made
|
350
|
-
end
|
351
|
-
|
352
|
-
it "returns false" do
|
353
|
-
expect(@hook).to be(false)
|
354
|
-
end
|
355
|
-
end
|
356
|
-
|
357
|
-
context "when JSON response" do
|
358
|
-
before do
|
359
|
-
stub_delete("/projects/1/hooks/1", "project_hook")
|
360
|
-
@hook = Gitlab.delete_project_hook(1, 1)
|
361
|
-
end
|
362
|
-
|
363
|
-
it "gets the correct resource" do
|
364
|
-
expect(a_delete("/projects/1/hooks/1")).to have_been_made
|
365
|
-
end
|
366
|
-
|
367
|
-
it "returns information about a deleted hook" do
|
368
|
-
expect(@hook.url).to eq("https://api.example.net/v1/webhooks/ci")
|
369
|
-
end
|
370
|
-
end
|
371
|
-
end
|
372
|
-
|
373
|
-
describe ".push_rule" do
|
374
|
-
before do
|
375
|
-
stub_get("/projects/1/push_rule", "push_rule")
|
376
|
-
@push_rule = Gitlab.push_rule(1)
|
377
|
-
end
|
378
|
-
|
379
|
-
it "gets the correct resource" do
|
380
|
-
expect(a_get("/projects/1/push_rule")).to have_been_made
|
381
|
-
end
|
382
|
-
|
383
|
-
it "returns information about a push rule" do
|
384
|
-
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
385
|
-
end
|
386
|
-
end
|
387
|
-
|
388
|
-
describe ".add_push_rule" do
|
389
|
-
before do
|
390
|
-
stub_post("/projects/1/push_rule", "push_rule")
|
391
|
-
@push_rule = Gitlab.add_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
|
392
|
-
end
|
393
|
-
|
394
|
-
it "gets the correct resource" do
|
395
|
-
expect(a_post("/projects/1/push_rule")).to have_been_made
|
396
|
-
end
|
397
|
-
|
398
|
-
it "returns information about an added push rule" do
|
399
|
-
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
400
|
-
end
|
401
|
-
end
|
402
|
-
|
403
|
-
describe ".edit_push_rule" do
|
404
|
-
before do
|
405
|
-
stub_put("/projects/1/push_rule", "push_rule")
|
406
|
-
@push_rule = Gitlab.edit_push_rule(1, { deny_delete_tag: false, commit_message_regex: "\\b[A-Z]{3}-[0-9]+\\b" })
|
407
|
-
end
|
408
|
-
|
409
|
-
it "gets the correct resource" do
|
410
|
-
expect(a_put("/projects/1/push_rule")).to have_been_made
|
411
|
-
end
|
412
|
-
|
413
|
-
it "returns information about an edited push rule" do
|
414
|
-
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
415
|
-
end
|
416
|
-
end
|
417
|
-
|
418
|
-
describe ".delete_push_rule" do
|
419
|
-
context "when empty response" do
|
420
|
-
before do
|
421
|
-
stub_request(:delete, "#{Gitlab.endpoint}/projects/1/push_rule").
|
422
|
-
with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token }).
|
423
|
-
to_return(body: '')
|
424
|
-
@push_rule = Gitlab.delete_push_rule(1)
|
425
|
-
end
|
426
|
-
|
427
|
-
it "gets the correct resource" do
|
428
|
-
expect(a_delete("/projects/1/push_rule")).to have_been_made
|
429
|
-
end
|
430
|
-
|
431
|
-
it "returns false" do
|
432
|
-
expect(@push_rule).to be(false)
|
433
|
-
end
|
434
|
-
end
|
435
|
-
|
436
|
-
context "when JSON response" do
|
437
|
-
before do
|
438
|
-
stub_delete("/projects/1/push_rule", "push_rule")
|
439
|
-
@push_rule = Gitlab.delete_push_rule(1)
|
440
|
-
end
|
441
|
-
|
442
|
-
it "gets the correct resource" do
|
443
|
-
expect(a_delete("/projects/1/push_rule")).to have_been_made
|
444
|
-
end
|
445
|
-
|
446
|
-
it "returns information about a deleted push rule" do
|
447
|
-
expect(@push_rule.commit_message_regex).to eq("\\b[A-Z]{3}-[0-9]+\\b")
|
448
|
-
end
|
449
|
-
end
|
450
|
-
end
|
451
|
-
|
452
|
-
describe ".make_forked_from" do
|
453
|
-
before do
|
454
|
-
stub_post("/projects/42/fork/24", "project_fork_link")
|
455
|
-
@forked_project_link = Gitlab.make_forked_from(42, 24)
|
456
|
-
end
|
457
|
-
|
458
|
-
it "gets the correct resource" do
|
459
|
-
expect(a_post("/projects/42/fork/24")).to have_been_made
|
460
|
-
end
|
461
|
-
|
462
|
-
it "returns information about a forked project" do
|
463
|
-
expect(@forked_project_link.forked_from_project_id).to eq(24)
|
464
|
-
expect(@forked_project_link.forked_to_project_id).to eq(42)
|
465
|
-
end
|
466
|
-
end
|
467
|
-
|
468
|
-
describe ".remove_forked" do
|
469
|
-
before do
|
470
|
-
stub_delete("/projects/42/fork", "project_fork_link")
|
471
|
-
@forked_project_link = Gitlab.remove_forked(42)
|
472
|
-
end
|
473
|
-
|
474
|
-
it "gets the correct resource" do
|
475
|
-
expect(a_delete("/projects/42/fork")).to have_been_made
|
476
|
-
end
|
477
|
-
|
478
|
-
it "returns information about an unforked project" do
|
479
|
-
expect(@forked_project_link.forked_to_project_id).to eq(42)
|
480
|
-
end
|
481
|
-
end
|
482
|
-
|
483
|
-
describe ".deploy_keys" do
|
484
|
-
before do
|
485
|
-
stub_get("/projects/42/deploy_keys", "project_keys")
|
486
|
-
@deploy_keys = Gitlab.deploy_keys(42)
|
487
|
-
end
|
488
|
-
|
489
|
-
it "gets the correct resource" do
|
490
|
-
expect(a_get("/projects/42/deploy_keys")).to have_been_made
|
491
|
-
end
|
492
|
-
|
493
|
-
it "returns project deploy keys" do
|
494
|
-
expect(@deploy_keys).to be_a Gitlab::PaginatedResponse
|
495
|
-
expect(@deploy_keys.first.id).to eq 2
|
496
|
-
expect(@deploy_keys.first.title).to eq "Key Title"
|
497
|
-
expect(@deploy_keys.first.key).to match(/ssh-rsa/)
|
498
|
-
end
|
499
|
-
end
|
500
|
-
|
501
|
-
describe ".deploy_key" do
|
502
|
-
before do
|
503
|
-
stub_get("/projects/42/deploy_keys/2", "project_key")
|
504
|
-
@deploy_key = Gitlab.deploy_key(42, 2)
|
505
|
-
end
|
506
|
-
|
507
|
-
it "gets the correct resource" do
|
508
|
-
expect(a_get("/projects/42/deploy_keys/2")).to have_been_made
|
509
|
-
end
|
510
|
-
|
511
|
-
it "returns project deploy key" do
|
512
|
-
expect(@deploy_key.id).to eq 2
|
513
|
-
expect(@deploy_key.title).to eq "Key Title"
|
514
|
-
expect(@deploy_key.key).to match(/ssh-rsa/)
|
515
|
-
end
|
516
|
-
end
|
517
|
-
|
518
|
-
describe ".delete_deploy_key" do
|
519
|
-
before do
|
520
|
-
stub_delete("/projects/42/deploy_keys/2", "project_key")
|
521
|
-
@deploy_key = Gitlab.delete_deploy_key(42, 2)
|
522
|
-
end
|
523
|
-
|
524
|
-
it "gets the correct resource" do
|
525
|
-
expect(a_delete("/projects/42/deploy_keys/2")).to have_been_made
|
526
|
-
end
|
527
|
-
|
528
|
-
it "returns information about a deleted key" do
|
529
|
-
expect(@deploy_key.id).to eq(2)
|
530
|
-
end
|
531
|
-
end
|
532
|
-
|
533
|
-
describe ".enable_deploy_key" do
|
534
|
-
before do
|
535
|
-
stub_post("/projects/42/deploy_keys/2/enable", "project_key")
|
536
|
-
@deploy_key = Gitlab.enable_deploy_key(42, 2)
|
537
|
-
end
|
538
|
-
|
539
|
-
it "gets the correct resource" do
|
540
|
-
expect(a_post("/projects/42/deploy_keys/2/enable").
|
541
|
-
with(body: { id: '42', key_id: '2' })).to have_been_made
|
542
|
-
end
|
543
|
-
|
544
|
-
it "returns information about an enabled key" do
|
545
|
-
expect(@deploy_key.id).to eq(2)
|
546
|
-
end
|
547
|
-
end
|
548
|
-
|
549
|
-
describe ".disable_deploy_key" do
|
550
|
-
before do
|
551
|
-
stub_post("/projects/42/deploy_keys/2/disable", "project_key")
|
552
|
-
@deploy_key = Gitlab.disable_deploy_key(42, 2)
|
553
|
-
end
|
554
|
-
|
555
|
-
it "gets the correct resource" do
|
556
|
-
expect(a_post("/projects/42/deploy_keys/2/disable").
|
557
|
-
with(body: { id: '42', key_id: '2' })).to have_been_made
|
558
|
-
end
|
559
|
-
|
560
|
-
it "returns information about a disabled key" do
|
561
|
-
expect(@deploy_key.id).to eq(2)
|
562
|
-
end
|
563
|
-
end
|
564
|
-
|
565
|
-
describe ".share_project_with_group" do
|
566
|
-
before do
|
567
|
-
stub_post("/projects/3/share", "group")
|
568
|
-
@group = Gitlab.share_project_with_group(3, 10, 40)
|
569
|
-
end
|
570
|
-
|
571
|
-
it "gets the correct resource" do
|
572
|
-
expect(a_post("/projects/3/share").
|
573
|
-
with(body: { group_id: '10', group_access: '40' })).to have_been_made
|
574
|
-
end
|
575
|
-
|
576
|
-
it "returns information about an added group" do
|
577
|
-
expect(@group.id).to eq(10)
|
578
|
-
end
|
579
|
-
end
|
580
|
-
|
581
|
-
describe ".star_project" do
|
582
|
-
before do
|
583
|
-
stub_post("/projects/3/star", "project_star")
|
584
|
-
@starred_project = Gitlab.star_project(3)
|
585
|
-
end
|
586
|
-
|
587
|
-
it "gets the correct resource" do
|
588
|
-
expect(a_post("/projects/3/star")).to have_been_made
|
589
|
-
end
|
590
|
-
|
591
|
-
it "returns information about the starred project" do
|
592
|
-
expect(@starred_project.id).to eq(3)
|
593
|
-
end
|
594
|
-
end
|
595
|
-
|
596
|
-
describe ".unstar_project" do
|
597
|
-
before do
|
598
|
-
stub_delete("/projects/3/star", "project_unstar")
|
599
|
-
@unstarred_project = Gitlab.unstar_project(3)
|
600
|
-
end
|
601
|
-
|
602
|
-
it "gets the correct resource" do
|
603
|
-
expect(a_delete("/projects/3/star")).to have_been_made
|
604
|
-
end
|
605
|
-
|
606
|
-
it "returns information about the unstarred project" do
|
607
|
-
expect(@unstarred_project.id).to eq(3)
|
608
|
-
end
|
609
|
-
end
|
610
|
-
|
611
|
-
describe ".user_projects" do
|
612
|
-
let(:user_id) { 1 }
|
613
|
-
let(:project_id) { 1 }
|
614
|
-
|
615
|
-
before do
|
616
|
-
stub_get("/users/#{user_id}/projects", "user_projects")
|
617
|
-
@user_projects = Gitlab.user_projects(user_id)
|
618
|
-
end
|
619
|
-
|
620
|
-
it "gets the correct resource" do
|
621
|
-
expect(a_get("/users/#{user_id}/projects")).to have_been_made
|
622
|
-
end
|
623
|
-
|
624
|
-
it "returns a paginated response of projects" do
|
625
|
-
expect(@user_projects).to be_a Gitlab::PaginatedResponse
|
626
|
-
expect(@user_projects.first.id).to eq(project_id)
|
627
|
-
expect(@user_projects.first.owner.id).to eq(user_id)
|
628
|
-
end
|
629
|
-
end
|
630
|
-
end
|