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
data/spec/gitlab_spec.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Gitlab do
|
4
|
-
after { Gitlab.reset }
|
5
|
-
|
6
|
-
describe ".client" do
|
7
|
-
it "is a Gitlab::Client" do
|
8
|
-
expect(Gitlab.client).to be_a Gitlab::Client
|
9
|
-
end
|
10
|
-
|
11
|
-
it "does not override each other" do
|
12
|
-
client1 = Gitlab.client(endpoint: 'https://api1.example.com', private_token: '001')
|
13
|
-
client2 = Gitlab.client(endpoint: 'https://api2.example.com', private_token: '002')
|
14
|
-
expect(client1.endpoint).to eq('https://api1.example.com')
|
15
|
-
expect(client2.endpoint).to eq('https://api2.example.com')
|
16
|
-
expect(client1.private_token).to eq('001')
|
17
|
-
expect(client2.private_token).to eq('002')
|
18
|
-
end
|
19
|
-
|
20
|
-
it "sets private_token to the auth_token when provided" do
|
21
|
-
client = Gitlab.client(endpoint: 'https://api2.example.com', auth_token: '3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603')
|
22
|
-
expect(client.private_token).to eq('3225e2804d31fea13fc41fc83bffef00cfaedc463118646b154acc6f94747603')
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe ".actions" do
|
27
|
-
it "returns an array of client methods" do
|
28
|
-
actions = Gitlab.actions
|
29
|
-
expect(actions).to be_an Array
|
30
|
-
expect(actions.first).to be_a Symbol
|
31
|
-
expect(actions.sort.first).to eq(:accept_merge_request)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
describe ".endpoint=" do
|
36
|
-
it "sets endpoint" do
|
37
|
-
Gitlab.endpoint = 'https://api.example.com'
|
38
|
-
expect(Gitlab.endpoint).to eq('https://api.example.com')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe ".private_token=" do
|
43
|
-
it "sets private_token" do
|
44
|
-
Gitlab.private_token = 'secret'
|
45
|
-
expect(Gitlab.private_token).to eq('secret')
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
describe ".auth_token=" do
|
50
|
-
it "sets auth_token", focus: true do
|
51
|
-
Gitlab.auth_token = 'auth_secret'
|
52
|
-
expect(Gitlab.private_token).to eq('auth_secret')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
describe ".sudo=" do
|
57
|
-
it "sets sudo" do
|
58
|
-
Gitlab.sudo = 'user'
|
59
|
-
expect(Gitlab.sudo).to eq('user')
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
describe ".user_agent" do
|
64
|
-
it "returns default user_agent" do
|
65
|
-
expect(Gitlab.user_agent).to eq(Gitlab::Configuration::DEFAULT_USER_AGENT)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
describe ".user_agent=" do
|
70
|
-
it "sets user_agent" do
|
71
|
-
Gitlab.user_agent = 'Custom User Agent'
|
72
|
-
expect(Gitlab.user_agent).to eq('Custom User Agent')
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
describe ".configure" do
|
77
|
-
Gitlab::Configuration::VALID_OPTIONS_KEYS.each do |key|
|
78
|
-
it "sets #{key}" do
|
79
|
-
Gitlab.configure do |config|
|
80
|
-
config.send("#{key}=", key)
|
81
|
-
expect(Gitlab.send(key)).to eq(key)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
describe ".http_proxy" do
|
88
|
-
it "delegates the method to Gitlab::Request" do
|
89
|
-
Gitlab.endpoint = 'https://api.example.com'
|
90
|
-
request = class_spy(Gitlab::Request).as_stubbed_const
|
91
|
-
|
92
|
-
Gitlab.http_proxy('proxy.example.net', 1987, 'user', 'pass')
|
93
|
-
expect(request).to have_received(:http_proxy).with('proxy.example.net', 1987, 'user', 'pass')
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'webmock/rspec'
|
3
|
-
|
4
|
-
require File.expand_path('../../lib/gitlab', __FILE__)
|
5
|
-
require File.expand_path('../../lib/gitlab/cli', __FILE__)
|
6
|
-
|
7
|
-
def capture_output
|
8
|
-
out = StringIO.new
|
9
|
-
$stdout = out
|
10
|
-
$stderr = out
|
11
|
-
yield
|
12
|
-
$stdout = STDOUT
|
13
|
-
$stderr = STDERR
|
14
|
-
out.string
|
15
|
-
end
|
16
|
-
|
17
|
-
def load_fixture(name)
|
18
|
-
File.new(File.dirname(__FILE__) + "/fixtures/#{name}.json")
|
19
|
-
end
|
20
|
-
|
21
|
-
RSpec.configure do |config|
|
22
|
-
config.before(:all) do
|
23
|
-
Gitlab.endpoint = 'https://api.example.com'
|
24
|
-
Gitlab.private_token = 'secret'
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
%i(get post put delete).each do |method|
|
29
|
-
define_method "stub_#{method}" do |path, fixture, status_code=200|
|
30
|
-
stub_request(method, "#{Gitlab.endpoint}#{path}")
|
31
|
-
.with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
|
32
|
-
.to_return(body: load_fixture(fixture), status: status_code)
|
33
|
-
end
|
34
|
-
|
35
|
-
define_method "a_#{method}" do |path|
|
36
|
-
a_request(method, "#{Gitlab.endpoint}#{path}")
|
37
|
-
.with(headers: { 'PRIVATE-TOKEN' => Gitlab.private_token })
|
38
|
-
end
|
39
|
-
end
|