vx-service_connector 0.2.13 → 0.2.14
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/bitbucket/repos.rb +4 -3
- data/lib/vx/service_connector/bitbucket/session.rb +1 -1
- data/lib/vx/service_connector/version.rb +1 -1
- data/spec/fixtures/bitbucket/changesets.json +28 -0
- data/spec/fixtures/bitbucket/user_privileges.json +2 -2
- data/spec/lib/bitbucket_spec.rb +29 -19
- data/spec/support/bitbucket_web_mocks.rb +3 -3
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee74c22f7e23a99b63146371054be5de0129c869
|
4
|
+
data.tar.gz: e6ccec32fb14ac0ed95f2908dd656c9f57d24506
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54a71ec3abedd40bbf6b7688fac5c5ff8e2499dc9a49dd3336c6f4052a38b3b596c2c6232a125a8c923f0d969a95f88c1cfec39238868afe6c844e3f1208942c
|
7
|
+
data.tar.gz: 57b7f8fc37b4848270a20a053e92ddeacda64465649a6e81909321982e8c3caf73c2e1143e1e9e3e69c6a4eef45a3ad0ca0998c84d5f94854b2f527b796338a3
|
@@ -24,7 +24,7 @@ module Vx
|
|
24
24
|
name,
|
25
25
|
name,
|
26
26
|
repo['is_private'],
|
27
|
-
"git@#{session.endpoint.host}
|
27
|
+
"git@#{session.endpoint.host}:#{name}.git",
|
28
28
|
"#{session.endpoint}/#{name}",
|
29
29
|
repo['description']
|
30
30
|
)
|
@@ -33,7 +33,8 @@ module Vx
|
|
33
33
|
def team_admin
|
34
34
|
@team_admin ||= begin
|
35
35
|
values = session.get("api/1.0/user/privileges")['teams']
|
36
|
-
values.select{|k,v| v == 'admin' }.keys
|
36
|
+
values = values.select{|k,v| v == 'admin' }.keys
|
37
|
+
values
|
37
38
|
end
|
38
39
|
end
|
39
40
|
|
@@ -46,7 +47,7 @@ module Vx
|
|
46
47
|
end
|
47
48
|
|
48
49
|
def repo_access?(repo_owner)
|
49
|
-
repo_owner == login ||
|
50
|
+
(repo_owner == login) ||
|
50
51
|
team_admin.include?(repo_owner)
|
51
52
|
end
|
52
53
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
{
|
2
|
+
"count": 116,
|
3
|
+
"start": null,
|
4
|
+
"limit": 1,
|
5
|
+
"changesets": [
|
6
|
+
{
|
7
|
+
"node": "5bf6aff99e83",
|
8
|
+
"files": [
|
9
|
+
{
|
10
|
+
"type": "modified",
|
11
|
+
"file": "robots.txt"
|
12
|
+
}
|
13
|
+
],
|
14
|
+
"raw_author": "Dmitry Galinsky <dima.exe@gmail.com>",
|
15
|
+
"utctimestamp": "2014-10-22 20:40:03+00:00",
|
16
|
+
"author": "dmexe",
|
17
|
+
"timestamp": "2014-10-22 22:40:03",
|
18
|
+
"raw_node": "5bf6aff99e8350c493ecce2016c50d977de88d6f",
|
19
|
+
"parents": [
|
20
|
+
"b14806535f5e"
|
21
|
+
],
|
22
|
+
"branch": "test",
|
23
|
+
"message": "test\n",
|
24
|
+
"revision": null,
|
25
|
+
"size": -1
|
26
|
+
}
|
27
|
+
]
|
28
|
+
}
|
data/spec/lib/bitbucket_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Vx::ServiceConnector::Bitbucket do
|
|
4
4
|
|
5
5
|
include BitbucketWebMocks
|
6
6
|
|
7
|
-
let(:login) { '
|
7
|
+
let(:login) { 'dmexe' }
|
8
8
|
let(:token) { 'token' }
|
9
9
|
let(:repo) { create :repo }
|
10
10
|
let(:bitbucket) {
|
@@ -22,15 +22,15 @@ describe Vx::ServiceConnector::Bitbucket do
|
|
22
22
|
mock_get_last_commit repo.full_name
|
23
23
|
c = commits.last
|
24
24
|
expect(c).to be
|
25
|
-
expect(c.message).to eq "
|
25
|
+
expect(c.message).to eq "test\n"
|
26
26
|
expect(c.skip).to be_false
|
27
27
|
expect(c.pull_request?).to be_false
|
28
|
-
expect(c.branch).to eq '
|
29
|
-
expect(c.branch_label).to eq '
|
30
|
-
expect(c.sha).to eq '
|
31
|
-
expect(c.author).to eq '
|
32
|
-
expect(c.author_email).to eq '
|
33
|
-
expect(c.web_url).to eq 'https://bitbucket.org/
|
28
|
+
expect(c.branch).to eq 'test'
|
29
|
+
expect(c.branch_label).to eq 'test'
|
30
|
+
expect(c.sha).to eq '5bf6aff99e8350c493ecce2016c50d977de88d6f'
|
31
|
+
expect(c.author).to eq 'Dmitry Galinsky'
|
32
|
+
expect(c.author_email).to eq 'dima.exe@gmail.com'
|
33
|
+
expect(c.web_url).to eq 'https://bitbucket.org/full/name/commits/5bf6aff99e8350c493ecce2016c50d977de88d6f'
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -45,22 +45,32 @@ describe Vx::ServiceConnector::Bitbucket do
|
|
45
45
|
mock_user_privileges
|
46
46
|
end
|
47
47
|
|
48
|
-
it { should have(
|
48
|
+
it { should have(3).item }
|
49
49
|
|
50
50
|
context "values" do
|
51
51
|
subject { bitbucket.repos.map(&:values) }
|
52
52
|
|
53
53
|
it { should eq(
|
54
|
-
|
55
|
-
|
56
|
-
"
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
"
|
54
|
+
|
55
|
+
[
|
56
|
+
["121111foobar/vx-promo",
|
57
|
+
"121111foobar/vx-promo",
|
58
|
+
false,
|
59
|
+
"git@bitbucket.org/121111foobar/vx-promo.git",
|
60
|
+
"https://bitbucket.org/121111foobar/vx-promo",
|
61
|
+
""],
|
62
|
+
["dmexe/demo",
|
63
|
+
"dmexe/demo",
|
64
|
+
true,
|
65
|
+
"git@bitbucket.org/dmexe/demo.git",
|
66
|
+
"https://bitbucket.org/dmexe/demo",
|
67
|
+
""],
|
68
|
+
["dmexe/vx-binutils",
|
69
|
+
"dmexe/vx-binutils",
|
70
|
+
false,
|
71
|
+
"git@bitbucket.org/dmexe/vx-binutils.git",
|
72
|
+
"https://bitbucket.org/dmexe/vx-binutils",
|
73
|
+
""]]
|
64
74
|
) }
|
65
75
|
|
66
76
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module BitbucketWebMocks
|
2
2
|
|
3
3
|
def mock_get_last_commit(repo_name)
|
4
|
-
mock_get "https://bitbucket.org/api/1.0/repositories/#{repo.full_name}/changesets/?limit=1", '
|
4
|
+
mock_get "https://bitbucket.org/api/1.0/repositories/#{repo.full_name}/changesets/?limit=1", 'changesets'
|
5
5
|
end
|
6
6
|
|
7
7
|
def mock_get_commit(repo_name, sha)
|
@@ -13,7 +13,7 @@ module BitbucketWebMocks
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def mock_user_repos
|
16
|
-
mock_get "https://bitbucket.org/api/1.0/user/repositories", "
|
16
|
+
mock_get "https://bitbucket.org/api/1.0/user/repositories", "repos"
|
17
17
|
end
|
18
18
|
|
19
19
|
def mock_user_privileges
|
@@ -31,7 +31,7 @@ module BitbucketWebMocks
|
|
31
31
|
|
32
32
|
def mock_add_deploy_key
|
33
33
|
mock_post "https://bitbucket.org/api/1.0/repositories/full/name/deploy-keys",
|
34
|
-
|
34
|
+
{"key"=>"public key", "label"=>"octocat@octomac"},
|
35
35
|
"add_deploy_key"
|
36
36
|
end
|
37
37
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vx-service_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Galinsky
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- lib/vx/service_connector/model.rb
|
170
170
|
- lib/vx/service_connector/version.rb
|
171
171
|
- spec/fixtures/bitbucket/add_deploy_key.json
|
172
|
+
- spec/fixtures/bitbucket/changesets.json
|
172
173
|
- spec/fixtures/bitbucket/commit.json
|
173
174
|
- spec/fixtures/bitbucket/create_hook.json
|
174
175
|
- spec/fixtures/bitbucket/deploy_keys.json
|
@@ -256,6 +257,7 @@ specification_version: 4
|
|
256
257
|
summary: vx-service_connector
|
257
258
|
test_files:
|
258
259
|
- spec/fixtures/bitbucket/add_deploy_key.json
|
260
|
+
- spec/fixtures/bitbucket/changesets.json
|
259
261
|
- spec/fixtures/bitbucket/commit.json
|
260
262
|
- spec/fixtures/bitbucket/create_hook.json
|
261
263
|
- spec/fixtures/bitbucket/deploy_keys.json
|