vx-service_connector 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vx/service_connector/base.rb +3 -4
- data/lib/vx/service_connector/github/payload.rb +73 -38
- data/lib/vx/service_connector/github.rb +6 -6
- data/lib/vx/service_connector/{gitlab_v4 → gitlab_v5}/files.rb +1 -1
- data/lib/vx/service_connector/{gitlab_v4 → gitlab_v5}/hooks.rb +1 -1
- data/lib/vx/service_connector/{gitlab_v4 → gitlab_v5}/notices.rb +1 -1
- data/lib/vx/service_connector/gitlab_v5/payload.rb +112 -0
- data/lib/vx/service_connector/{gitlab_v4 → gitlab_v5}/repos.rb +1 -1
- data/lib/vx/service_connector/{gitlab_v4 → gitlab_v5}/session.rb +1 -1
- data/lib/vx/service_connector/gitlab_v5.rb +30 -2
- data/lib/vx/service_connector/model.rb +12 -20
- data/lib/vx/service_connector/version.rb +1 -1
- data/lib/vx/service_connector.rb +0 -19
- data/spec/fixtures/github/payload/foreign_pull_request.json +810 -1
- data/spec/fixtures/github/payload/pull_request.json +0 -1
- data/spec/fixtures/github/payload/push_tag.json +0 -1
- data/spec/fixtures/{gitlab_v4 → gitlab_v5}/commits.json +0 -0
- data/spec/fixtures/{gitlab_v4 → gitlab_v5}/hooks.json +0 -0
- data/spec/fixtures/gitlab_v5/payload/push.json +32 -0
- data/spec/fixtures/{gitlab_v4 → gitlab_v5}/projects.json +0 -0
- data/spec/fixtures/{gitlab_v4 → gitlab_v5}/user_keys.json +0 -0
- data/spec/lib/github_payload_spec.rb +43 -94
- data/spec/lib/github_spec.rb +0 -23
- data/spec/lib/gitlab_v5_payload_spec.rb +33 -0
- data/spec/lib/gitlab_v5_spec.rb +74 -0
- data/spec/lib/model_spec.rb +3 -28
- data/spec/lib/service_connector_spec.rb +0 -35
- data/spec/support/github_web_mocks.rb +2 -2
- data/spec/support/gitlab_v5_web_mocks.rb +41 -2
- metadata +20 -32
- data/lib/vx/service_connector/github/commits.rb +0 -33
- data/lib/vx/service_connector/gitlab_v4/commits.rb +0 -35
- data/lib/vx/service_connector/gitlab_v4/deploy_keys.rb +0 -32
- data/lib/vx/service_connector/gitlab_v4/payload.rb +0 -126
- data/lib/vx/service_connector/gitlab_v4.rb +0 -49
- data/spec/fixtures/gitlab_v4/payload/merge_request1_unchecked.json +0 -47
- data/spec/fixtures/gitlab_v4/payload/merge_request2_can_be_merge.json +0 -47
- data/spec/fixtures/gitlab_v4/payload/push.json +0 -106
- data/spec/lib/gitlab_v4_payload_spec.rb +0 -101
- data/spec/lib/gitlab_v4_spec.rb +0 -141
- data/spec/support/gitlab_v4_web_mocks.rb +0 -73
File without changes
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
"before": "0000000000000000000000000000000000000000",
|
3
|
+
"after": "decc3915e29d7ae1786bb981b2ea3702afae592a",
|
4
|
+
"ref": "refs/heads/testing",
|
5
|
+
"user_id": 13,
|
6
|
+
"user_name": "Dmitry",
|
7
|
+
"repository": {
|
8
|
+
"name": "event_generator",
|
9
|
+
"url": "git@git.dev.gorod-skidok.com:serverist2/event_generator.git",
|
10
|
+
"description": null,
|
11
|
+
"homepage": "http://git.dev.gorod-skidok.com/serverist2/event_generator"
|
12
|
+
},
|
13
|
+
"commits": null,
|
14
|
+
"total_commits_count": 0,
|
15
|
+
"_service": "gitlab",
|
16
|
+
"token": "cb170b9c-8274-43e6-80c8-f1a744ac43b4",
|
17
|
+
"repo_callback": {
|
18
|
+
"before": "0000000000000000000000000000000000000000",
|
19
|
+
"after": "decc3915e29d7ae1786bb981b2ea3702afae592a",
|
20
|
+
"ref": "refs/heads/testing",
|
21
|
+
"user_id": 13,
|
22
|
+
"user_name": "Dmitry",
|
23
|
+
"repository": {
|
24
|
+
"name": "event_generator",
|
25
|
+
"url": "git@git.dev.gorod-skidok.com:serverist2/event_generator.git",
|
26
|
+
"description": null,
|
27
|
+
"homepage": "http://git.dev.gorod-skidok.com/serverist2/event_generator"
|
28
|
+
},
|
29
|
+
"commits": null,
|
30
|
+
"total_commits_count": 0
|
31
|
+
}
|
32
|
+
}
|
File without changes
|
File without changes
|
@@ -1,136 +1,85 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Vx::ServiceConnector::Github::Payload do
|
4
|
+
|
5
|
+
include GithubWebMocks
|
6
|
+
|
4
7
|
let(:content) { read_json_fixture("github/payload/push") }
|
5
|
-
let(:
|
8
|
+
let(:github) { Vx::ServiceConnector::Github.new 'login', 'token' }
|
9
|
+
let(:repo) { create :repo }
|
10
|
+
let(:payload) { github.payload repo, content }
|
6
11
|
subject { payload }
|
7
12
|
|
8
13
|
context "push" do
|
9
|
-
let(:url) { "https://github.com/evrone/ci-worker-test-repo/
|
14
|
+
let(:url) { "https://github.com/evrone/ci-worker-test-repo/commit/687753389908e70801dd4ff5448be908642055c6" }
|
10
15
|
|
11
16
|
its(:pull_request?) { should be_false }
|
12
17
|
its(:pull_request_number) { should be_nil }
|
13
|
-
its(:
|
14
|
-
its(:base) { should eq 'b665f90239563c030f1b280a434b3d84daeda1bd' }
|
18
|
+
its(:sha) { should eq '84158c732ff1af3db9775a37a74ddc39f5c4078f' }
|
15
19
|
its(:branch) { should eq 'master' }
|
16
20
|
its(:branch_label) { should eq 'master' }
|
17
|
-
its(:
|
18
|
-
|
19
|
-
its(:
|
20
|
-
its(:
|
21
|
+
its(:message) { should eq 'test commit #3' }
|
22
|
+
its(:author) { should eq 'Dmitry Galinsky' }
|
23
|
+
its(:author_email) { should eq 'dima.exe@gmail.com' }
|
24
|
+
its(:web_url) { should eq url }
|
25
|
+
its(:ignore?) { should be_false }
|
21
26
|
end
|
22
27
|
|
23
28
|
context "pull_request" do
|
24
29
|
let(:content) { read_json_fixture("github/payload/pull_request") }
|
25
|
-
let(:url) { "https://
|
30
|
+
let(:url) { "https://github.com/evrone/cybergifts/pull/177" }
|
31
|
+
let(:sha) { '84158c732ff1af3db9775a37a74ddc39f5c4078f' }
|
32
|
+
|
33
|
+
before do
|
34
|
+
mock_get_commit 'evrone/cybergifts', sha
|
35
|
+
end
|
26
36
|
|
27
37
|
its(:pull_request?) { should be_true }
|
28
38
|
its(:pull_request_number) { should eq 177 }
|
29
|
-
its(:
|
30
|
-
its(:base) { should eq 'a1ea1a6807ab8de87e0d685b7d5dcad0c081254e' }
|
39
|
+
its(:sha) { should eq sha }
|
31
40
|
its(:branch) { should eq 'test' }
|
32
41
|
its(:branch_label) { should eq 'dima-exe:test' }
|
33
|
-
its(:
|
34
|
-
|
35
|
-
its(:
|
36
|
-
its(:
|
42
|
+
its(:message) { should eq 'Fix all the bugs' }
|
43
|
+
its(:author) { should eq 'Monalisa Octocat' }
|
44
|
+
its(:author_email) { should eq 'support@github.com' }
|
45
|
+
its(:web_url) { should eq url }
|
46
|
+
its(:ignore?) { should be_true }
|
37
47
|
end
|
38
48
|
|
39
|
-
context "tag
|
49
|
+
context "push tag" do
|
40
50
|
let(:content) { read_json_fixture("github/payload/push_tag") }
|
41
|
-
|
42
|
-
|
51
|
+
its(:ignore?) { should be_true }
|
52
|
+
end
|
43
53
|
|
44
|
-
|
45
|
-
|
46
|
-
it { should be_false }
|
47
|
-
end
|
54
|
+
context "closed pull request" do
|
55
|
+
let(:content) { read_json_fixture("github/payload/closed_pull_request") }
|
48
56
|
|
49
|
-
|
50
|
-
|
51
|
-
it { should be_false }
|
57
|
+
before do
|
58
|
+
mock_get_commit 'evrone/cybergifts', '84158c732ff1af3db9775a37a74ddc39f5c4078f'
|
52
59
|
end
|
53
|
-
end
|
54
60
|
|
55
|
-
|
56
|
-
subject { payload.closed_pull_request? }
|
57
|
-
context "when state is closed" do
|
58
|
-
let(:content) { read_json_fixture("github/payload/closed_pull_request") }
|
59
|
-
it { should be_true }
|
60
|
-
end
|
61
|
+
its(:ignore?) { should be_true }
|
61
62
|
end
|
62
63
|
|
63
|
-
context "
|
64
|
-
|
65
|
-
|
66
|
-
context "when same repo" do
|
67
|
-
let(:content) { read_json_fixture("github/payload/pull_request") }
|
68
|
-
it { should be_false }
|
69
|
-
end
|
64
|
+
context "foreign pull request" do
|
65
|
+
let(:content) { read_json_fixture("github/payload/foreign_pull_request") }
|
70
66
|
|
71
|
-
|
72
|
-
|
73
|
-
it { should be_true }
|
67
|
+
before do
|
68
|
+
mock_get_commit 'evrone/serverist-email-provider', 'f57c385116139082811442ad48cb6127c29eb351'
|
74
69
|
end
|
75
70
|
|
76
|
-
|
77
|
-
it { should be_false }
|
78
|
-
end
|
71
|
+
its(:ignore?) { should be_false }
|
79
72
|
end
|
80
73
|
|
81
|
-
context "
|
82
|
-
subject { payload.ignore? }
|
83
|
-
|
84
|
-
context "when pull request" do
|
85
|
-
let(:content) { read_json_fixture("github/payload/foreign_pull_request") }
|
86
|
-
it { should be_false}
|
74
|
+
context "pull request with same repo" do
|
87
75
|
|
88
|
-
|
89
|
-
before do
|
90
|
-
expect(payload).to receive(:closed_pull_request?) { true }
|
91
|
-
end
|
92
|
-
it { should be_true }
|
93
|
-
end
|
94
|
-
|
95
|
-
context "and same repo" do
|
96
|
-
let(:content) { read_json_fixture("github/payload/pull_request") }
|
97
|
-
it { should be_true }
|
98
|
-
end
|
99
|
-
end
|
76
|
+
let(:content) { read_json_fixture("github/payload/pull_request") }
|
100
77
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
context "and deleted branch" do
|
105
|
-
before do
|
106
|
-
expect(payload).to receive(:head) { '0000000000000000000000000000000000000000' }
|
107
|
-
end
|
108
|
-
it { should be_true }
|
109
|
-
end
|
110
|
-
|
111
|
-
context "and tag created" do
|
112
|
-
before do
|
113
|
-
expect(payload).to receive(:tag?) { true }
|
114
|
-
end
|
115
|
-
it { should be_true }
|
116
|
-
end
|
78
|
+
before do
|
79
|
+
mock_get_commit 'evrone/cybergifts', '84158c732ff1af3db9775a37a74ddc39f5c4078f'
|
117
80
|
end
|
118
|
-
end
|
119
81
|
|
120
|
-
|
121
|
-
subject { payload.to_model }
|
122
|
-
it { should be_instance_of(Vx::ServiceConnector::Model::Payload) }
|
123
|
-
|
124
|
-
its(:values) { should eq(
|
125
|
-
[false,
|
126
|
-
nil,
|
127
|
-
"84158c732ff1af3db9775a37a74ddc39f5c4078f",
|
128
|
-
"b665f90239563c030f1b280a434b3d84daeda1bd",
|
129
|
-
"master",
|
130
|
-
"master",
|
131
|
-
"https://github.com/evrone/ci-worker-test-repo/compare/b665f9023956...687753389908",
|
132
|
-
false]
|
133
|
-
) }
|
82
|
+
its(:ignore?) { should be_true }
|
134
83
|
end
|
135
84
|
|
136
85
|
end
|
data/spec/lib/github_spec.rb
CHANGED
@@ -133,27 +133,4 @@ describe Vx::ServiceConnector::Github do
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
context "(commits)" do
|
137
|
-
let(:sha) { 'sha' }
|
138
|
-
|
139
|
-
context "get" do
|
140
|
-
subject { github.commits(repo).get sha }
|
141
|
-
|
142
|
-
context "success" do
|
143
|
-
before { mock_get_commit }
|
144
|
-
it { should be }
|
145
|
-
its(:sha) { should eq '6dcb09b5b57875f334f61aebed695e2e4193db5e' }
|
146
|
-
its(:message) { should eq 'Fix all the bugs' }
|
147
|
-
its(:author) { should eq 'Monalisa Octocat' }
|
148
|
-
its(:author_email) { should eq 'support@github.com' }
|
149
|
-
its(:http_url) { should be_nil }
|
150
|
-
end
|
151
|
-
|
152
|
-
context "not found" do
|
153
|
-
before { mock_get_commit_not_found }
|
154
|
-
it { should be_nil }
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
136
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Vx::ServiceConnector::GitlabV5::Payload do
|
4
|
+
|
5
|
+
include GitlabV5WebMocks
|
6
|
+
|
7
|
+
let(:content) { read_json_fixture("gitlab_v5/payload/push") }
|
8
|
+
let(:repo) { create :repo }
|
9
|
+
let(:gitlab) { Vx::ServiceConnector::GitlabV5.new 'http://example.com', 'token' }
|
10
|
+
let(:payload) { gitlab.payload(repo, content) }
|
11
|
+
subject { payload }
|
12
|
+
|
13
|
+
context "push" do
|
14
|
+
let(:sha) { 'decc3915e29d7ae1786bb981b2ea3702afae592a' }
|
15
|
+
let(:url) { "http://git.dev.gorod-skidok.com/serverist2/event_generator/commit/decc3915e29d7ae1786bb981b2ea3702afae592a" }
|
16
|
+
|
17
|
+
before do
|
18
|
+
mock_get_commit 1, sha
|
19
|
+
end
|
20
|
+
|
21
|
+
its(:pull_request?) { should be_false }
|
22
|
+
its(:pull_request_number) { should be_nil }
|
23
|
+
its(:sha) { should eq sha }
|
24
|
+
its(:branch) { should eq 'testing' }
|
25
|
+
its(:branch_label) { should eq 'testing' }
|
26
|
+
its(:message) { should eq 'Replace sanitize with escape once' }
|
27
|
+
its(:author) { should eq 'Dmitriy Zaporozhets' }
|
28
|
+
its(:author_email) { should eq 'dzaporozhets@sphereconsultinginc.com' }
|
29
|
+
its(:web_url) { should eq url }
|
30
|
+
its(:ignore?) { should be_false }
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
data/spec/lib/gitlab_v5_spec.rb
CHANGED
@@ -13,6 +13,32 @@ describe Vx::ServiceConnector::GitlabV5 do
|
|
13
13
|
|
14
14
|
it { should be }
|
15
15
|
|
16
|
+
context "(notices)" do
|
17
|
+
let(:notices) { gitlab.notices(repo) }
|
18
|
+
|
19
|
+
context "create" do
|
20
|
+
subject { notices.create nil, nil, nil, nil }
|
21
|
+
it { should be :not_available }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "(repos)" do
|
26
|
+
subject { gitlab.repos }
|
27
|
+
|
28
|
+
before do
|
29
|
+
mock_repos
|
30
|
+
end
|
31
|
+
|
32
|
+
it { should have(1).item }
|
33
|
+
|
34
|
+
context "values" do
|
35
|
+
subject { gitlab.repos.map(&:values) }
|
36
|
+
it { should eq(
|
37
|
+
[[9, "example/sqerp", true, "git@example.com:sqerp.git", "http://example.com:80/sqerp", nil]]
|
38
|
+
) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
16
42
|
context "(deploy_keys)" do
|
17
43
|
let(:key_name) { 'me@example.com' }
|
18
44
|
let(:public_key) { 'public key' }
|
@@ -40,4 +66,52 @@ describe Vx::ServiceConnector::GitlabV5 do
|
|
40
66
|
it { should have(1).item }
|
41
67
|
end
|
42
68
|
end
|
69
|
+
|
70
|
+
context "(hooks)" do
|
71
|
+
let(:url) { 'url' }
|
72
|
+
let(:token) { 'token' }
|
73
|
+
let(:hooks) { gitlab.hooks(repo) }
|
74
|
+
|
75
|
+
context "all" do
|
76
|
+
subject { hooks.all }
|
77
|
+
before { mock_hooks }
|
78
|
+
it { should have(1).item }
|
79
|
+
end
|
80
|
+
|
81
|
+
context "create" do
|
82
|
+
subject { hooks.create url, token }
|
83
|
+
before { mock_add_hook }
|
84
|
+
it { should be }
|
85
|
+
end
|
86
|
+
|
87
|
+
context "destroy" do
|
88
|
+
let(:mask) { "http://example.com" }
|
89
|
+
subject { hooks.destroy mask }
|
90
|
+
before do
|
91
|
+
mock_hooks
|
92
|
+
mock_remove_hook
|
93
|
+
end
|
94
|
+
it { should have(1).item }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
context "(files)" do
|
99
|
+
let(:sha) { 'sha' }
|
100
|
+
let(:path) { 'path' }
|
101
|
+
|
102
|
+
context "get" do
|
103
|
+
subject { gitlab.files(repo).get sha, path }
|
104
|
+
|
105
|
+
context "success" do
|
106
|
+
before { mock_get_file }
|
107
|
+
it { should eq 'content' }
|
108
|
+
end
|
109
|
+
|
110
|
+
context "not found" do
|
111
|
+
before { mock_get_file_not_found }
|
112
|
+
it { should be_nil }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
43
117
|
end
|
data/spec/lib/model_spec.rb
CHANGED
@@ -2,36 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "(models)" do
|
4
4
|
context Vx::ServiceConnector::Model::Payload do
|
5
|
-
let(:values) {
|
6
|
-
[false, nil, 'head', 'base', 'master', 'master:label',
|
7
|
-
'http://example.com', false]
|
8
|
-
}
|
9
|
-
let(:payload) { described_class.new(*values) }
|
10
|
-
subject { payload }
|
11
|
-
|
12
|
-
it { should be }
|
13
|
-
its(:values) { should eq values }
|
14
|
-
|
15
|
-
context "to_hash" do
|
16
|
-
subject { payload.to_hash }
|
17
|
-
it { should eq({
|
18
|
-
:base => "base",
|
19
|
-
:branch => "master",
|
20
|
-
:branch_label => "master:label",
|
21
|
-
:head => "head",
|
22
|
-
:ignore? => false,
|
23
|
-
:pull_request? => false,
|
24
|
-
:pull_request_number => nil,
|
25
|
-
:url => "http://example.com"
|
26
|
-
}) }
|
27
|
-
end
|
28
5
|
|
29
6
|
context ".from_hash" do
|
30
|
-
let(:params) {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
its(:values) { should eq payload.values }
|
7
|
+
let(:params) { Vx::ServiceConnector::Model.test_payload_attributes }
|
8
|
+
subject { described_class.from_hash(params).to_hash }
|
9
|
+
it { should eq params }
|
35
10
|
end
|
36
11
|
end
|
37
12
|
end
|
@@ -2,17 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Vx::ServiceConnector do
|
4
4
|
|
5
|
-
context ".payload" do
|
6
|
-
subject { described_class.payload type, params }
|
7
|
-
|
8
|
-
context ":github" do
|
9
|
-
let(:type) { :github }
|
10
|
-
let(:params) { read_json_fixture("github/payload/push") }
|
11
|
-
it { should be }
|
12
|
-
it { should be_an_instance_of(Vx::ServiceConnector::Model::Payload) }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
5
|
context "to" do
|
17
6
|
subject { described_class.to(name).to_s }
|
18
7
|
|
@@ -21,34 +10,10 @@ describe Vx::ServiceConnector do
|
|
21
10
|
it { should be_include("Github") }
|
22
11
|
end
|
23
12
|
|
24
|
-
context ":gitlab_v4" do
|
25
|
-
let(:name) { :gitlab_v4 }
|
26
|
-
it { should be_include("GitlabV4") }
|
27
|
-
end
|
28
|
-
|
29
13
|
context ":gitlab_v5" do
|
30
14
|
let(:name) { :gitlab_v5 }
|
31
15
|
it { should be_include("GitlabV5") }
|
32
16
|
end
|
33
17
|
end
|
34
18
|
|
35
|
-
context "payload" do
|
36
|
-
subject { described_class.payload(name, {}) }
|
37
|
-
|
38
|
-
context ":github" do
|
39
|
-
let(:name) { :github }
|
40
|
-
it { should be }
|
41
|
-
end
|
42
|
-
|
43
|
-
context ":gitlab_v4" do
|
44
|
-
let(:name) { :gitlab_v4 }
|
45
|
-
it { should be }
|
46
|
-
end
|
47
|
-
|
48
|
-
context ":gitlab_v5" do
|
49
|
-
let(:name) { :gitlab_v5 }
|
50
|
-
it { should be }
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
19
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module GithubWebMocks
|
2
2
|
|
3
|
-
def mock_get_commit
|
4
|
-
mock_get "https://api.github.com/repos/
|
3
|
+
def mock_get_commit(repo_name, sha)
|
4
|
+
mock_get "https://api.github.com/repos/#{repo_name}/commits/#{sha}", 'commit'
|
5
5
|
end
|
6
6
|
|
7
7
|
def mock_get_commit_not_found
|
@@ -1,16 +1,55 @@
|
|
1
1
|
module GitlabV5WebMocks
|
2
|
+
|
3
|
+
def mock_repos
|
4
|
+
mock_get "projects", 'projects'
|
5
|
+
end
|
6
|
+
|
2
7
|
def mock_deploy_keys
|
3
|
-
mock_get "projects/1/keys",
|
8
|
+
mock_get "projects/1/keys", 'deploy_keys'
|
4
9
|
end
|
5
10
|
|
6
11
|
def mock_add_deploy_key
|
7
|
-
mock_post "projects/1/keys",
|
12
|
+
mock_post "projects/1/keys", '{"title":"me@example.com","key":"public key"}'
|
8
13
|
end
|
9
14
|
|
10
15
|
def mock_delete_deploy_key
|
11
16
|
mock_delete "projects/1/keys/3", nil
|
12
17
|
end
|
13
18
|
|
19
|
+
def mock_add_hook
|
20
|
+
mock_post "projects/1/hooks", "{\"url\":\"url\",\"push_events\":true,\"merge_requests_events\":true}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def mock_remove_hook
|
24
|
+
mock_delete "projects/1/hooks?hook_id=57", ""
|
25
|
+
end
|
26
|
+
|
27
|
+
def mock_hooks
|
28
|
+
mock_get "projects/1/hooks", 'hooks'
|
29
|
+
end
|
30
|
+
|
31
|
+
def mock_get_file
|
32
|
+
stub_request(:get, "http://example.com/api/v3/projects/1/repository/commits/sha/blob?filepath=path").
|
33
|
+
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'Private-Token'=>'token'}).
|
34
|
+
to_return(:status => 200, :body => "content")
|
35
|
+
end
|
36
|
+
|
37
|
+
def mock_get_file_not_found
|
38
|
+
stub_request(:get, "http://example.com/api/v3/projects/1/repository/commits/sha/blob?filepath=path").
|
39
|
+
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'Private-Token'=>'token'}).
|
40
|
+
to_return(:status => 404, :body => "")
|
41
|
+
end
|
42
|
+
|
43
|
+
def mock_get_commit(pid, sha)
|
44
|
+
mock_get "projects/#{pid}/repository/commits?ref_name=#{sha}", 'commits'
|
45
|
+
end
|
46
|
+
|
47
|
+
def mock_get_commit_not_found
|
48
|
+
stub_request(:get, "http://example.com/api/v3/projects/1/repository/commits?ref_name=sha").
|
49
|
+
with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json', 'Private-Token'=>'token'}).
|
50
|
+
to_return(:status => 404, :body => "")
|
51
|
+
end
|
52
|
+
|
14
53
|
def mock_get(url, fixture)
|
15
54
|
stub_request(:get, "http://example.com/api/v3/#{url}").
|
16
55
|
with(:headers => {'Accept'=>'application/json', 'PRIVATE-TOKEN' => "token"}).
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vx-service_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -112,24 +112,20 @@ files:
|
|
112
112
|
- lib/vx/service_connector/base.rb
|
113
113
|
- lib/vx/service_connector/error.rb
|
114
114
|
- lib/vx/service_connector/github.rb
|
115
|
-
- lib/vx/service_connector/github/commits.rb
|
116
115
|
- lib/vx/service_connector/github/deploy_keys.rb
|
117
116
|
- lib/vx/service_connector/github/files.rb
|
118
117
|
- lib/vx/service_connector/github/hooks.rb
|
119
118
|
- lib/vx/service_connector/github/notices.rb
|
120
119
|
- lib/vx/service_connector/github/payload.rb
|
121
120
|
- lib/vx/service_connector/github/repos.rb
|
122
|
-
- lib/vx/service_connector/gitlab_v4.rb
|
123
|
-
- lib/vx/service_connector/gitlab_v4/commits.rb
|
124
|
-
- lib/vx/service_connector/gitlab_v4/deploy_keys.rb
|
125
|
-
- lib/vx/service_connector/gitlab_v4/files.rb
|
126
|
-
- lib/vx/service_connector/gitlab_v4/hooks.rb
|
127
|
-
- lib/vx/service_connector/gitlab_v4/notices.rb
|
128
|
-
- lib/vx/service_connector/gitlab_v4/payload.rb
|
129
|
-
- lib/vx/service_connector/gitlab_v4/repos.rb
|
130
|
-
- lib/vx/service_connector/gitlab_v4/session.rb
|
131
121
|
- lib/vx/service_connector/gitlab_v5.rb
|
132
122
|
- lib/vx/service_connector/gitlab_v5/deploy_keys.rb
|
123
|
+
- lib/vx/service_connector/gitlab_v5/files.rb
|
124
|
+
- lib/vx/service_connector/gitlab_v5/hooks.rb
|
125
|
+
- lib/vx/service_connector/gitlab_v5/notices.rb
|
126
|
+
- lib/vx/service_connector/gitlab_v5/payload.rb
|
127
|
+
- lib/vx/service_connector/gitlab_v5/repos.rb
|
128
|
+
- lib/vx/service_connector/gitlab_v5/session.rb
|
133
129
|
- lib/vx/service_connector/model.rb
|
134
130
|
- lib/vx/service_connector/version.rb
|
135
131
|
- spec/fixtures/github/add_deploy_key.json
|
@@ -146,25 +142,21 @@ files:
|
|
146
142
|
- spec/fixtures/github/payload/push.json
|
147
143
|
- spec/fixtures/github/payload/push_tag.json
|
148
144
|
- spec/fixtures/github/user_repos.json
|
149
|
-
- spec/fixtures/
|
150
|
-
- spec/fixtures/gitlab_v4/hooks.json
|
151
|
-
- spec/fixtures/gitlab_v4/payload/merge_request1_unchecked.json
|
152
|
-
- spec/fixtures/gitlab_v4/payload/merge_request2_can_be_merge.json
|
153
|
-
- spec/fixtures/gitlab_v4/payload/push.json
|
154
|
-
- spec/fixtures/gitlab_v4/projects.json
|
155
|
-
- spec/fixtures/gitlab_v4/user_keys.json
|
145
|
+
- spec/fixtures/gitlab_v5/commits.json
|
156
146
|
- spec/fixtures/gitlab_v5/deploy_keys.json
|
147
|
+
- spec/fixtures/gitlab_v5/hooks.json
|
148
|
+
- spec/fixtures/gitlab_v5/payload/push.json
|
149
|
+
- spec/fixtures/gitlab_v5/projects.json
|
150
|
+
- spec/fixtures/gitlab_v5/user_keys.json
|
157
151
|
- spec/lib/github_payload_spec.rb
|
158
152
|
- spec/lib/github_spec.rb
|
159
|
-
- spec/lib/
|
160
|
-
- spec/lib/gitlab_v4_spec.rb
|
153
|
+
- spec/lib/gitlab_v5_payload_spec.rb
|
161
154
|
- spec/lib/gitlab_v5_spec.rb
|
162
155
|
- spec/lib/model_spec.rb
|
163
156
|
- spec/lib/service_connector_spec.rb
|
164
157
|
- spec/spec_helper.rb
|
165
158
|
- spec/support/create.rb
|
166
159
|
- spec/support/github_web_mocks.rb
|
167
|
-
- spec/support/gitlab_v4_web_mocks.rb
|
168
160
|
- spec/support/gitlab_v5_web_mocks.rb
|
169
161
|
- spec/support/read_fixture.rb
|
170
162
|
- vx-service_connector.gemspec
|
@@ -207,24 +199,20 @@ test_files:
|
|
207
199
|
- spec/fixtures/github/payload/push.json
|
208
200
|
- spec/fixtures/github/payload/push_tag.json
|
209
201
|
- spec/fixtures/github/user_repos.json
|
210
|
-
- spec/fixtures/
|
211
|
-
- spec/fixtures/gitlab_v4/hooks.json
|
212
|
-
- spec/fixtures/gitlab_v4/payload/merge_request1_unchecked.json
|
213
|
-
- spec/fixtures/gitlab_v4/payload/merge_request2_can_be_merge.json
|
214
|
-
- spec/fixtures/gitlab_v4/payload/push.json
|
215
|
-
- spec/fixtures/gitlab_v4/projects.json
|
216
|
-
- spec/fixtures/gitlab_v4/user_keys.json
|
202
|
+
- spec/fixtures/gitlab_v5/commits.json
|
217
203
|
- spec/fixtures/gitlab_v5/deploy_keys.json
|
204
|
+
- spec/fixtures/gitlab_v5/hooks.json
|
205
|
+
- spec/fixtures/gitlab_v5/payload/push.json
|
206
|
+
- spec/fixtures/gitlab_v5/projects.json
|
207
|
+
- spec/fixtures/gitlab_v5/user_keys.json
|
218
208
|
- spec/lib/github_payload_spec.rb
|
219
209
|
- spec/lib/github_spec.rb
|
220
|
-
- spec/lib/
|
221
|
-
- spec/lib/gitlab_v4_spec.rb
|
210
|
+
- spec/lib/gitlab_v5_payload_spec.rb
|
222
211
|
- spec/lib/gitlab_v5_spec.rb
|
223
212
|
- spec/lib/model_spec.rb
|
224
213
|
- spec/lib/service_connector_spec.rb
|
225
214
|
- spec/spec_helper.rb
|
226
215
|
- spec/support/create.rb
|
227
216
|
- spec/support/github_web_mocks.rb
|
228
|
-
- spec/support/gitlab_v4_web_mocks.rb
|
229
217
|
- spec/support/gitlab_v5_web_mocks.rb
|
230
218
|
- spec/support/read_fixture.rb
|