vx-service_connector 0.4.5 → 0.4.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/bitbucket/repos.rb +41 -23
- data/lib/vx/service_connector/github/repos.rb +14 -8
- data/lib/vx/service_connector/version.rb +1 -1
- data/spec/fixtures/bitbucket/repos_team1.json +126 -0
- data/spec/fixtures/bitbucket/repos_team2.json +126 -0
- data/spec/fixtures/bitbucket/teams.json +36 -0
- data/spec/lib/bitbucket_spec.rb +98 -31
- data/spec/support/bitbucket_web_mocks.rb +6 -2
- metadata +8 -4
- data/spec/fixtures/bitbucket/repos.json +0 -206
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8dd689ce4de0b574983a85638a7394385052d5a
|
4
|
+
data.tar.gz: a301274c5db42cae5d92ad8c3d7004eaad84b7fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 289257bfe1885e00d06a24ecb1d6f5939024f83cc82b5cc07a80844baccb09893820cf26fe0591ed34491e83c5f5130591b1f63f5ccf9dc0f19e989bad492395
|
7
|
+
data.tar.gz: 1375050a0621ce0196e2f5625601462d2f57b9263951dd0763eefe813cc75d879c27b76fcd203e60703635b5f5160b99290196856c64777a73a87ef3dc6de34d
|
@@ -4,26 +4,57 @@ module Vx
|
|
4
4
|
Repos = Struct.new(:session) do
|
5
5
|
|
6
6
|
def to_a
|
7
|
-
@repos ||=
|
7
|
+
@repos ||= all_repos
|
8
8
|
end
|
9
9
|
|
10
10
|
private
|
11
11
|
|
12
|
-
def
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
def path(p)
|
13
|
+
"api/2.0/#{p}?role=admin&pagelen=100"
|
14
|
+
end
|
15
|
+
|
16
|
+
def teams
|
17
|
+
res = session.get(path "teams")
|
18
|
+
|
19
|
+
if list = res["values"]
|
20
|
+
list.map { |team| team["username"] }
|
21
|
+
else
|
22
|
+
[]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def all_repos
|
27
|
+
all_teams = [login] + teams
|
28
|
+
all_teams.map do |name|
|
29
|
+
Thread.new do
|
30
|
+
by_username(name)
|
31
|
+
end.tap do |t|
|
32
|
+
t.abort_on_exception = true
|
19
33
|
end
|
20
|
-
|
34
|
+
end.flat_map(&:value)
|
35
|
+
end
|
36
|
+
|
37
|
+
def by_username(name)
|
38
|
+
res = session.get(path "repositories/#{name}")
|
39
|
+
if values = res["values"]
|
40
|
+
make_repos_list(values)
|
41
|
+
else
|
21
42
|
[]
|
22
43
|
end
|
23
44
|
end
|
24
45
|
|
46
|
+
def make_repos_list(values)
|
47
|
+
values.reduce([]) do |repos, repo|
|
48
|
+
if git?(repo)
|
49
|
+
repos << repo_to_model(repo)
|
50
|
+
else
|
51
|
+
repos
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
25
56
|
def repo_to_model(repo)
|
26
|
-
name = repo[
|
57
|
+
name = repo["full_name"]
|
27
58
|
Model::Repo.new(
|
28
59
|
name,
|
29
60
|
name,
|
@@ -35,14 +66,6 @@ module Vx
|
|
35
66
|
)
|
36
67
|
end
|
37
68
|
|
38
|
-
def team_admin
|
39
|
-
@team_admin ||= begin
|
40
|
-
values = session.get("api/1.0/user/privileges")['teams']
|
41
|
-
values = values.select{|k,v| v == 'admin' }.keys
|
42
|
-
values
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
69
|
def login
|
47
70
|
session.login
|
48
71
|
end
|
@@ -55,11 +78,6 @@ module Vx
|
|
55
78
|
repo['scm'] == 'git'
|
56
79
|
end
|
57
80
|
|
58
|
-
def repo_access?(repo_owner)
|
59
|
-
(repo_owner == login) ||
|
60
|
-
team_admin.include?(repo_owner)
|
61
|
-
end
|
62
|
-
|
63
81
|
end
|
64
82
|
end
|
65
83
|
end
|
@@ -19,24 +19,30 @@ module Vx
|
|
19
19
|
organizations.map do |org|
|
20
20
|
Thread.new do
|
21
21
|
begin
|
22
|
-
session
|
23
|
-
|
24
|
-
.select { |repo| repo.permissions && repo.permissions.admin }
|
25
|
-
.map { |repo| repo_to_model repo }
|
22
|
+
session.organization_repositories(org)
|
23
|
+
.reduce([], &filter_repos)
|
26
24
|
rescue Octokit::Unauthorized
|
27
25
|
[]
|
28
26
|
end
|
29
27
|
end.tap do |th|
|
30
28
|
th.abort_on_exception = true
|
31
29
|
end
|
32
|
-
end.
|
30
|
+
end.flat_map(&:value)
|
31
|
+
end
|
32
|
+
|
33
|
+
def filter_repos
|
34
|
+
->(repos, repo) {
|
35
|
+
if repo.permissions && repo.permissions.admin
|
36
|
+
repos << repo_to_model(repo)
|
37
|
+
else
|
38
|
+
repos
|
39
|
+
end
|
40
|
+
}
|
33
41
|
end
|
34
42
|
|
35
43
|
def user_repositories
|
36
44
|
begin
|
37
|
-
session.repositories
|
38
|
-
.select { |repo| repo.permissions && repo.permissions.admin }
|
39
|
-
.map { |repo| repo_to_model repo }
|
45
|
+
session.repositories.reduce([], &filter_repos)
|
40
46
|
rescue Octokit::Unauthorized
|
41
47
|
[]
|
42
48
|
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
{
|
2
|
+
"pagelen": 10,
|
3
|
+
"values": [{
|
4
|
+
"scm": "git",
|
5
|
+
"has_wiki": true,
|
6
|
+
"description": "",
|
7
|
+
"links": {
|
8
|
+
"watchers": {
|
9
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/watchers"
|
10
|
+
},
|
11
|
+
"commits": {
|
12
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/commits"
|
13
|
+
},
|
14
|
+
"self": {
|
15
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket"
|
16
|
+
},
|
17
|
+
"html": {
|
18
|
+
"href": "https://bitbucket.org/teamsinspace/design-bucket"
|
19
|
+
},
|
20
|
+
"avatar": {
|
21
|
+
"href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/fc0cb8a00976/img/language-avatars/default_16.png"
|
22
|
+
},
|
23
|
+
"forks": {
|
24
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/forks"
|
25
|
+
},
|
26
|
+
"clone": [{
|
27
|
+
"href": "https://bitbucket.org/teamsinspace/design-bucket.git",
|
28
|
+
"name": "https"
|
29
|
+
}, {
|
30
|
+
"href": "ssh://git@bitbucket.org/teamsinspace/design-bucket.git",
|
31
|
+
"name": "ssh"
|
32
|
+
}],
|
33
|
+
"pullrequests": {
|
34
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/pullrequests"
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"fork_policy": "allow_forks",
|
38
|
+
"name": "design-bucket1",
|
39
|
+
"language": "",
|
40
|
+
"created_on": "2014-07-25T01:10:59.815371+00:00",
|
41
|
+
"full_name": "teamsinspace/design-bucket1",
|
42
|
+
"has_issues": false,
|
43
|
+
"owner": {
|
44
|
+
"username": "teamsinspace",
|
45
|
+
"display_name": "Teams In Space",
|
46
|
+
"uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}",
|
47
|
+
"links": {
|
48
|
+
"self": {
|
49
|
+
"href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
|
50
|
+
},
|
51
|
+
"html": {
|
52
|
+
"href": "https://bitbucket.org/teamsinspace"
|
53
|
+
},
|
54
|
+
"avatar": {
|
55
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Sep/24/teamsinspace-avatar-3731530358-7_avatar.png"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"updated_on": "2014-10-29T21:28:23.189145+00:00",
|
60
|
+
"size": 1346635,
|
61
|
+
"is_private": false,
|
62
|
+
"uuid": "{23ff7c6f-6f21-4d0c-ae7e-35069e097686}"
|
63
|
+
}, {
|
64
|
+
"scm": "git",
|
65
|
+
"has_wiki": false,
|
66
|
+
"description": "",
|
67
|
+
"links": {
|
68
|
+
"watchers": {
|
69
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/watchers"
|
70
|
+
},
|
71
|
+
"commits": {
|
72
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/commits"
|
73
|
+
},
|
74
|
+
"self": {
|
75
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org"
|
76
|
+
},
|
77
|
+
"html": {
|
78
|
+
"href": "https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org"
|
79
|
+
},
|
80
|
+
"avatar": {
|
81
|
+
"href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/fc0cb8a00976/img/language-avatars/default_16.png"
|
82
|
+
},
|
83
|
+
"forks": {
|
84
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/forks"
|
85
|
+
},
|
86
|
+
"clone": [{
|
87
|
+
"href": "https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org.git",
|
88
|
+
"name": "https"
|
89
|
+
}, {
|
90
|
+
"href": "ssh://git@bitbucket.org/teamsinspace/teamsinspace.bitbucket.org.git",
|
91
|
+
"name": "ssh"
|
92
|
+
}],
|
93
|
+
"pullrequests": {
|
94
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/pullrequests"
|
95
|
+
}
|
96
|
+
},
|
97
|
+
"fork_policy": "allow_forks",
|
98
|
+
"name": "teamsinspace.bitbucket.org1",
|
99
|
+
"language": "",
|
100
|
+
"created_on": "2014-09-23T16:40:12.835612+00:00",
|
101
|
+
"full_name": "teamsinspace/teamsinspace.bitbucket.org1",
|
102
|
+
"has_issues": false,
|
103
|
+
"owner": {
|
104
|
+
"username": "teamsinspace",
|
105
|
+
"display_name": "Teams In Space",
|
106
|
+
"uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}",
|
107
|
+
"links": {
|
108
|
+
"self": {
|
109
|
+
"href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
|
110
|
+
},
|
111
|
+
"html": {
|
112
|
+
"href": "https://bitbucket.org/teamsinspace"
|
113
|
+
},
|
114
|
+
"avatar": {
|
115
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Sep/24/teamsinspace-avatar-3731530358-7_avatar.png"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
},
|
119
|
+
"updated_on": "2014-09-25T17:36:42.979044+00:00",
|
120
|
+
"size": 76152,
|
121
|
+
"is_private": false,
|
122
|
+
"uuid": "{a2925176-b539-4985-b4d6-44c59850b3bb}"
|
123
|
+
}],
|
124
|
+
"page": 1,
|
125
|
+
"size": 2
|
126
|
+
}
|
@@ -0,0 +1,126 @@
|
|
1
|
+
{
|
2
|
+
"pagelen": 10,
|
3
|
+
"values": [{
|
4
|
+
"scm": "git",
|
5
|
+
"has_wiki": true,
|
6
|
+
"description": "",
|
7
|
+
"links": {
|
8
|
+
"watchers": {
|
9
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/watchers"
|
10
|
+
},
|
11
|
+
"commits": {
|
12
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/commits"
|
13
|
+
},
|
14
|
+
"self": {
|
15
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket"
|
16
|
+
},
|
17
|
+
"html": {
|
18
|
+
"href": "https://bitbucket.org/teamsinspace/design-bucket"
|
19
|
+
},
|
20
|
+
"avatar": {
|
21
|
+
"href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/fc0cb8a00976/img/language-avatars/default_16.png"
|
22
|
+
},
|
23
|
+
"forks": {
|
24
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/forks"
|
25
|
+
},
|
26
|
+
"clone": [{
|
27
|
+
"href": "https://bitbucket.org/teamsinspace/design-bucket.git",
|
28
|
+
"name": "https"
|
29
|
+
}, {
|
30
|
+
"href": "ssh://git@bitbucket.org/teamsinspace/design-bucket.git",
|
31
|
+
"name": "ssh"
|
32
|
+
}],
|
33
|
+
"pullrequests": {
|
34
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/design-bucket/pullrequests"
|
35
|
+
}
|
36
|
+
},
|
37
|
+
"fork_policy": "allow_forks",
|
38
|
+
"name": "design-bucket2",
|
39
|
+
"language": "",
|
40
|
+
"created_on": "2014-07-25T01:10:59.815371+00:00",
|
41
|
+
"full_name": "teamsinspace/design-bucket2",
|
42
|
+
"has_issues": false,
|
43
|
+
"owner": {
|
44
|
+
"username": "teamsinspace",
|
45
|
+
"display_name": "Teams In Space",
|
46
|
+
"uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}",
|
47
|
+
"links": {
|
48
|
+
"self": {
|
49
|
+
"href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
|
50
|
+
},
|
51
|
+
"html": {
|
52
|
+
"href": "https://bitbucket.org/teamsinspace"
|
53
|
+
},
|
54
|
+
"avatar": {
|
55
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Sep/24/teamsinspace-avatar-3731530358-7_avatar.png"
|
56
|
+
}
|
57
|
+
}
|
58
|
+
},
|
59
|
+
"updated_on": "2014-10-29T21:28:23.189145+00:00",
|
60
|
+
"size": 1346635,
|
61
|
+
"is_private": false,
|
62
|
+
"uuid": "{23ff7c6f-6f21-4d0c-ae7e-35069e097686}"
|
63
|
+
}, {
|
64
|
+
"scm": "git",
|
65
|
+
"has_wiki": false,
|
66
|
+
"description": "",
|
67
|
+
"links": {
|
68
|
+
"watchers": {
|
69
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/watchers"
|
70
|
+
},
|
71
|
+
"commits": {
|
72
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/commits"
|
73
|
+
},
|
74
|
+
"self": {
|
75
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org"
|
76
|
+
},
|
77
|
+
"html": {
|
78
|
+
"href": "https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org"
|
79
|
+
},
|
80
|
+
"avatar": {
|
81
|
+
"href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/fc0cb8a00976/img/language-avatars/default_16.png"
|
82
|
+
},
|
83
|
+
"forks": {
|
84
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/forks"
|
85
|
+
},
|
86
|
+
"clone": [{
|
87
|
+
"href": "https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org.git",
|
88
|
+
"name": "https"
|
89
|
+
}, {
|
90
|
+
"href": "ssh://git@bitbucket.org/teamsinspace/teamsinspace.bitbucket.org.git",
|
91
|
+
"name": "ssh"
|
92
|
+
}],
|
93
|
+
"pullrequests": {
|
94
|
+
"href": "https://api.bitbucket.org/2.0/repositories/teamsinspace/teamsinspace.bitbucket.org/pullrequests"
|
95
|
+
}
|
96
|
+
},
|
97
|
+
"fork_policy": "allow_forks",
|
98
|
+
"name": "teamsinspace.bitbucket.org2",
|
99
|
+
"language": "",
|
100
|
+
"created_on": "2014-09-23T16:40:12.835612+00:00",
|
101
|
+
"full_name": "teamsinspace/teamsinspace.bitbucket.org2",
|
102
|
+
"has_issues": false,
|
103
|
+
"owner": {
|
104
|
+
"username": "teamsinspace",
|
105
|
+
"display_name": "Teams In Space",
|
106
|
+
"uuid": "{61fc5cf6-d054-47d2-b4a9-061ccf858379}",
|
107
|
+
"links": {
|
108
|
+
"self": {
|
109
|
+
"href": "https://api.bitbucket.org/2.0/teams/teamsinspace"
|
110
|
+
},
|
111
|
+
"html": {
|
112
|
+
"href": "https://bitbucket.org/teamsinspace"
|
113
|
+
},
|
114
|
+
"avatar": {
|
115
|
+
"href": "https://bitbucket-assetroot.s3.amazonaws.com/c/photos/2014/Sep/24/teamsinspace-avatar-3731530358-7_avatar.png"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
},
|
119
|
+
"updated_on": "2014-09-25T17:36:42.979044+00:00",
|
120
|
+
"size": 76152,
|
121
|
+
"is_private": false,
|
122
|
+
"uuid": "{a2925176-b539-4985-b4d6-44c59850b3bb}"
|
123
|
+
}],
|
124
|
+
"page": 1,
|
125
|
+
"size": 2
|
126
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
{
|
2
|
+
"pagelen": 100,
|
3
|
+
"values": [{
|
4
|
+
"username": "team2",
|
5
|
+
"website": "",
|
6
|
+
"display_name": "the team",
|
7
|
+
"uuid": "{aa559944-83c9-4963-a9a8-69ac8d9cf5d2}",
|
8
|
+
"links": {
|
9
|
+
"self": {
|
10
|
+
"href": "https://api.bitbucket.org/2.0/teams/1team"
|
11
|
+
},
|
12
|
+
"repositories": {
|
13
|
+
"href": "https://api.bitbucket.org/2.0/repositories/1team"
|
14
|
+
},
|
15
|
+
"html": {
|
16
|
+
"href": "https://bitbucket.org/1team"
|
17
|
+
},
|
18
|
+
"followers": {
|
19
|
+
"href": "https://api.bitbucket.org/2.0/teams/1team/followers"
|
20
|
+
},
|
21
|
+
"avatar": {
|
22
|
+
"href": "https://d3oaxc4q5k2d6q.cloudfront.net/m/572a80470390/img/default_team_avatar/32/team_blue.png"
|
23
|
+
},
|
24
|
+
"members": {
|
25
|
+
"href": "https://api.bitbucket.org/2.0/teams/1team/members"
|
26
|
+
},
|
27
|
+
"following": {
|
28
|
+
"href": "https://api.bitbucket.org/2.0/teams/1team/following"
|
29
|
+
}
|
30
|
+
},
|
31
|
+
"created_on": "2013-04-22T18:09:29.103337+00:00",
|
32
|
+
"location": "",
|
33
|
+
"type": "team"
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}
|
data/spec/lib/bitbucket_spec.rb
CHANGED
@@ -34,45 +34,112 @@ describe Vx::ServiceConnector::Bitbucket do
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
|
38
|
-
|
37
|
+
context "repos class" do
|
38
|
+
subject { repos }
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
let(:repos) { described_class::Repos.new session }
|
41
|
+
let(:team) { "team2" }
|
42
|
+
let(:session) {
|
43
|
+
described_class::Session.new login, described_class::Session.test
|
44
|
+
}
|
42
45
|
|
43
46
|
before do
|
44
|
-
|
45
|
-
|
47
|
+
mock_repos("dmexe", "repos_team1")
|
48
|
+
mock_repos("team2", "repos_team2")
|
49
|
+
mock_teams
|
46
50
|
end
|
47
51
|
|
48
|
-
it
|
52
|
+
it "has correct teams" do
|
53
|
+
expect(subject.send :teams).to eq [team]
|
54
|
+
end
|
55
|
+
|
56
|
+
context "repos by_username" do
|
57
|
+
subject do
|
58
|
+
repos.send(:by_username, username).map(&:full_name)
|
59
|
+
end
|
60
|
+
|
61
|
+
context "login" do
|
62
|
+
let(:username) { login }
|
63
|
+
|
64
|
+
it do
|
65
|
+
should eq([
|
66
|
+
"teamsinspace/design-bucket1",
|
67
|
+
"teamsinspace/teamsinspace.bitbucket.org1"
|
68
|
+
])
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "team" do
|
73
|
+
let(:username) { team }
|
74
|
+
|
75
|
+
it do
|
76
|
+
should eq([
|
77
|
+
"teamsinspace/design-bucket2",
|
78
|
+
"teamsinspace/teamsinspace.bitbucket.org2"
|
79
|
+
])
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
49
83
|
|
50
|
-
context "values" do
|
51
|
-
subject { bitbucket.repos.map(&:values) }
|
52
84
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
"121111foobar/vx-promo",
|
58
|
-
false,
|
59
|
-
"git@bitbucket.org:121111foobar/vx-promo.git",
|
60
|
-
"https://bitbucket.org/121111foobar/vx-promo",
|
61
|
-
"", nil],
|
62
|
-
["dmexe/demo",
|
63
|
-
"dmexe/demo",
|
64
|
-
true,
|
65
|
-
"git@bitbucket.org:dmexe/demo.git",
|
66
|
-
"https://bitbucket.org/dmexe/demo",
|
67
|
-
"", nil],
|
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
|
-
"", nil]]
|
74
|
-
) }
|
85
|
+
context "all repos" do
|
86
|
+
subject do
|
87
|
+
repos.send(:all_repos).map(&:full_name)
|
88
|
+
end
|
75
89
|
|
90
|
+
it do
|
91
|
+
should eq([
|
92
|
+
"teamsinspace/design-bucket1",
|
93
|
+
"teamsinspace/teamsinspace.bitbucket.org1",
|
94
|
+
"teamsinspace/design-bucket2",
|
95
|
+
"teamsinspace/teamsinspace.bitbucket.org2"
|
96
|
+
])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
context "repos" do
|
101
|
+
subject { bitbucket.repos.map(&:values) }
|
102
|
+
|
103
|
+
it do
|
104
|
+
should eq([
|
105
|
+
[
|
106
|
+
"teamsinspace/design-bucket1",
|
107
|
+
"teamsinspace/design-bucket1",
|
108
|
+
false,
|
109
|
+
"git@bitbucket.org:teamsinspace/design-bucket1.git",
|
110
|
+
"https://bitbucket.org/teamsinspace/design-bucket1",
|
111
|
+
"",
|
112
|
+
nil
|
113
|
+
],
|
114
|
+
[
|
115
|
+
"teamsinspace/teamsinspace.bitbucket.org1",
|
116
|
+
"teamsinspace/teamsinspace.bitbucket.org1",
|
117
|
+
false,
|
118
|
+
"git@bitbucket.org:teamsinspace/teamsinspace.bitbucket.org1.git",
|
119
|
+
"https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org1",
|
120
|
+
"",
|
121
|
+
nil
|
122
|
+
],
|
123
|
+
[
|
124
|
+
"teamsinspace/design-bucket2",
|
125
|
+
"teamsinspace/design-bucket2",
|
126
|
+
false,
|
127
|
+
"git@bitbucket.org:teamsinspace/design-bucket2.git",
|
128
|
+
"https://bitbucket.org/teamsinspace/design-bucket2",
|
129
|
+
"",
|
130
|
+
nil
|
131
|
+
],
|
132
|
+
[
|
133
|
+
"teamsinspace/teamsinspace.bitbucket.org2",
|
134
|
+
"teamsinspace/teamsinspace.bitbucket.org2",
|
135
|
+
false,
|
136
|
+
"git@bitbucket.org:teamsinspace/teamsinspace.bitbucket.org2.git",
|
137
|
+
"https://bitbucket.org/teamsinspace/teamsinspace.bitbucket.org2",
|
138
|
+
"",
|
139
|
+
nil
|
140
|
+
]
|
141
|
+
])
|
142
|
+
end
|
76
143
|
end
|
77
144
|
end
|
78
145
|
|
@@ -12,8 +12,12 @@ module BitbucketWebMocks
|
|
12
12
|
mock_get 'https://bitbucket.org/api/2.0/repositories/full/name', 'user_repo'
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
16
|
-
mock_get "https://bitbucket.org/api/
|
15
|
+
def mock_repos(team_name, fixture_name)
|
16
|
+
mock_get "https://bitbucket.org/api/2.0/repositories/#{team_name}?role=admin&pagelen=100", fixture_name
|
17
|
+
end
|
18
|
+
|
19
|
+
def mock_teams
|
20
|
+
mock_get "https://bitbucket.org/api/2.0/teams?role=admin&pagelen=100", "teams"
|
17
21
|
end
|
18
22
|
|
19
23
|
def mock_user_privileges
|
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.4.
|
4
|
+
version: 0.4.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: 2015-04-
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: octokit
|
@@ -184,7 +184,9 @@ files:
|
|
184
184
|
- spec/fixtures/bitbucket/payload/foreign_pull_request.json
|
185
185
|
- spec/fixtures/bitbucket/payload/push.json
|
186
186
|
- spec/fixtures/bitbucket/payload/updated_pull_request.json
|
187
|
-
- spec/fixtures/bitbucket/
|
187
|
+
- spec/fixtures/bitbucket/repos_team1.json
|
188
|
+
- spec/fixtures/bitbucket/repos_team2.json
|
189
|
+
- spec/fixtures/bitbucket/teams.json
|
188
190
|
- spec/fixtures/bitbucket/user_privileges.json
|
189
191
|
- spec/fixtures/bitbucket/user_repo.json
|
190
192
|
- spec/fixtures/bitbucket/user_repos.json
|
@@ -278,7 +280,9 @@ test_files:
|
|
278
280
|
- spec/fixtures/bitbucket/payload/foreign_pull_request.json
|
279
281
|
- spec/fixtures/bitbucket/payload/push.json
|
280
282
|
- spec/fixtures/bitbucket/payload/updated_pull_request.json
|
281
|
-
- spec/fixtures/bitbucket/
|
283
|
+
- spec/fixtures/bitbucket/repos_team1.json
|
284
|
+
- spec/fixtures/bitbucket/repos_team2.json
|
285
|
+
- spec/fixtures/bitbucket/teams.json
|
282
286
|
- spec/fixtures/bitbucket/user_privileges.json
|
283
287
|
- spec/fixtures/bitbucket/user_repo.json
|
284
288
|
- spec/fixtures/bitbucket/user_repos.json
|
@@ -1,206 +0,0 @@
|
|
1
|
-
[
|
2
|
-
{
|
3
|
-
"scm": "git",
|
4
|
-
"has_wiki": false,
|
5
|
-
"last_updated": "2014-10-15T10:05:33.177",
|
6
|
-
"no_forks": false,
|
7
|
-
"created_on": "2014-10-15T10:05:32.883",
|
8
|
-
"owner": "121111foobar",
|
9
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/default_16.png",
|
10
|
-
"email_mailinglist": "",
|
11
|
-
"is_mq": false,
|
12
|
-
"size": 637892,
|
13
|
-
"read_only": false,
|
14
|
-
"fork_of": null,
|
15
|
-
"mq_of": null,
|
16
|
-
"state": "available",
|
17
|
-
"utc_created_on": "2014-10-15 08:05:32+00:00",
|
18
|
-
"website": "",
|
19
|
-
"description": "",
|
20
|
-
"has_issues": false,
|
21
|
-
"is_fork": false,
|
22
|
-
"slug": "vx-promo",
|
23
|
-
"is_private": false,
|
24
|
-
"name": "vx-promo",
|
25
|
-
"language": "",
|
26
|
-
"utc_last_updated": "2014-10-15 08:05:33+00:00",
|
27
|
-
"email_writers": true,
|
28
|
-
"no_public_forks": false,
|
29
|
-
"creator": "dmexe",
|
30
|
-
"resource_uri": "/1.0/repositories/121111foobar/vx-promo"
|
31
|
-
},
|
32
|
-
{
|
33
|
-
"scm": "git",
|
34
|
-
"has_wiki": false,
|
35
|
-
"last_updated": "2014-10-16T17:06:01.809",
|
36
|
-
"no_forks": false,
|
37
|
-
"created_on": "2014-10-11T18:24:18.946",
|
38
|
-
"owner": "tarasu",
|
39
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/ruby_16.png",
|
40
|
-
"email_mailinglist": "",
|
41
|
-
"is_mq": false,
|
42
|
-
"size": 304241,
|
43
|
-
"read_only": false,
|
44
|
-
"fork_of": null,
|
45
|
-
"mq_of": null,
|
46
|
-
"state": "available",
|
47
|
-
"utc_created_on": "2014-10-11 16:24:18+00:00",
|
48
|
-
"website": "",
|
49
|
-
"description": "repo for test api",
|
50
|
-
"has_issues": false,
|
51
|
-
"is_fork": false,
|
52
|
-
"slug": "api-test",
|
53
|
-
"is_private": false,
|
54
|
-
"name": "api-test",
|
55
|
-
"language": "ruby",
|
56
|
-
"utc_last_updated": "2014-10-16 15:06:01+00:00",
|
57
|
-
"email_writers": true,
|
58
|
-
"no_public_forks": false,
|
59
|
-
"creator": null,
|
60
|
-
"resource_uri": "/1.0/repositories/tarasu/api-test"
|
61
|
-
},
|
62
|
-
{
|
63
|
-
"scm": "git",
|
64
|
-
"has_wiki": false,
|
65
|
-
"last_updated": "2013-10-31T09:41:24.921",
|
66
|
-
"no_forks": false,
|
67
|
-
"created_on": "2013-10-30T22:52:07.507",
|
68
|
-
"owner": "tarasu",
|
69
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/default_16.png",
|
70
|
-
"email_mailinglist": "",
|
71
|
-
"is_mq": false,
|
72
|
-
"size": 14519503,
|
73
|
-
"read_only": false,
|
74
|
-
"fork_of": {
|
75
|
-
"scm": "git",
|
76
|
-
"has_wiki": false,
|
77
|
-
"last_updated": "2013-02-14T19:59:31.783",
|
78
|
-
"no_forks": null,
|
79
|
-
"created_on": "2013-02-14T19:51:46.916",
|
80
|
-
"owner": "artyomkeydunov",
|
81
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/default_16.png",
|
82
|
-
"email_mailinglist": "",
|
83
|
-
"is_mq": false,
|
84
|
-
"size": 13920588,
|
85
|
-
"read_only": false,
|
86
|
-
"creator": null,
|
87
|
-
"state": "available",
|
88
|
-
"utc_created_on": "2013-02-14 18:51:46+00:00",
|
89
|
-
"website": "",
|
90
|
-
"description": "",
|
91
|
-
"has_issues": false,
|
92
|
-
"is_fork": false,
|
93
|
-
"slug": "bfl_rails",
|
94
|
-
"is_private": true,
|
95
|
-
"name": "bfl_rails",
|
96
|
-
"language": "",
|
97
|
-
"utc_last_updated": "2013-02-14 18:59:31+00:00",
|
98
|
-
"email_writers": true,
|
99
|
-
"no_public_forks": true,
|
100
|
-
"resource_uri": "/1.0/repositories/artyomkeydunov/bfl_rails"
|
101
|
-
},
|
102
|
-
"mq_of": {
|
103
|
-
"scm": "git",
|
104
|
-
"has_wiki": false,
|
105
|
-
"last_updated": "2013-02-14T19:59:31.783",
|
106
|
-
"no_forks": null,
|
107
|
-
"created_on": "2013-02-14T19:51:46.916",
|
108
|
-
"owner": "artyomkeydunov",
|
109
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/default_16.png",
|
110
|
-
"email_mailinglist": "",
|
111
|
-
"is_mq": false,
|
112
|
-
"size": 13920588,
|
113
|
-
"read_only": false,
|
114
|
-
"creator": null,
|
115
|
-
"state": "available",
|
116
|
-
"utc_created_on": "2013-02-14 18:51:46+00:00",
|
117
|
-
"website": "",
|
118
|
-
"description": "",
|
119
|
-
"has_issues": false,
|
120
|
-
"is_fork": false,
|
121
|
-
"slug": "bfl_rails",
|
122
|
-
"is_private": true,
|
123
|
-
"name": "bfl_rails",
|
124
|
-
"language": "",
|
125
|
-
"utc_last_updated": "2013-02-14 18:59:31+00:00",
|
126
|
-
"email_writers": true,
|
127
|
-
"no_public_forks": true,
|
128
|
-
"resource_uri": "/1.0/repositories/artyomkeydunov/bfl_rails"
|
129
|
-
},
|
130
|
-
"state": "available",
|
131
|
-
"utc_created_on": "2013-10-30 21:52:07+00:00",
|
132
|
-
"website": null,
|
133
|
-
"description": "new",
|
134
|
-
"has_issues": false,
|
135
|
-
"is_fork": true,
|
136
|
-
"slug": "bfl_rails",
|
137
|
-
"is_private": true,
|
138
|
-
"name": "bfl_rails",
|
139
|
-
"language": "",
|
140
|
-
"utc_last_updated": "2013-10-31 08:41:24+00:00",
|
141
|
-
"email_writers": true,
|
142
|
-
"no_public_forks": true,
|
143
|
-
"creator": null,
|
144
|
-
"resource_uri": "/1.0/repositories/tarasu/bfl_rails"
|
145
|
-
},
|
146
|
-
{
|
147
|
-
"scm": "git",
|
148
|
-
"has_wiki": false,
|
149
|
-
"last_updated": "2014-10-04T13:35:59.140",
|
150
|
-
"no_forks": false,
|
151
|
-
"created_on": "2014-10-04T13:35:59.103",
|
152
|
-
"owner": "dmexe",
|
153
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/default_16.png",
|
154
|
-
"email_mailinglist": "",
|
155
|
-
"is_mq": false,
|
156
|
-
"size": 33348,
|
157
|
-
"read_only": false,
|
158
|
-
"fork_of": null,
|
159
|
-
"mq_of": null,
|
160
|
-
"state": "available",
|
161
|
-
"utc_created_on": "2014-10-04 11:35:59+00:00",
|
162
|
-
"website": null,
|
163
|
-
"description": "",
|
164
|
-
"has_issues": false,
|
165
|
-
"is_fork": false,
|
166
|
-
"slug": "demo",
|
167
|
-
"is_private": true,
|
168
|
-
"name": "demo",
|
169
|
-
"language": "",
|
170
|
-
"utc_last_updated": "2014-10-04 11:35:59+00:00",
|
171
|
-
"email_writers": true,
|
172
|
-
"no_public_forks": true,
|
173
|
-
"creator": null,
|
174
|
-
"resource_uri": "/1.0/repositories/dmexe/demo"
|
175
|
-
},
|
176
|
-
{
|
177
|
-
"scm": "git",
|
178
|
-
"has_wiki": false,
|
179
|
-
"last_updated": "2014-10-15T09:58:18.440",
|
180
|
-
"no_forks": false,
|
181
|
-
"created_on": "2014-10-15T09:58:18.393",
|
182
|
-
"owner": "dmexe",
|
183
|
-
"logo": "https://d3oaxc4q5k2d6q.cloudfront.net/m/7aaf1677069c/img/language-avatars/default_16.png",
|
184
|
-
"email_mailinglist": "",
|
185
|
-
"is_mq": false,
|
186
|
-
"size": 2871993,
|
187
|
-
"read_only": false,
|
188
|
-
"fork_of": null,
|
189
|
-
"mq_of": null,
|
190
|
-
"state": "available",
|
191
|
-
"utc_created_on": "2014-10-15 07:58:18+00:00",
|
192
|
-
"website": "",
|
193
|
-
"description": "",
|
194
|
-
"has_issues": false,
|
195
|
-
"is_fork": false,
|
196
|
-
"slug": "vx-binutils",
|
197
|
-
"is_private": false,
|
198
|
-
"name": "vx-binutils",
|
199
|
-
"language": "",
|
200
|
-
"utc_last_updated": "2014-10-15 07:58:18+00:00",
|
201
|
-
"email_writers": true,
|
202
|
-
"no_public_forks": false,
|
203
|
-
"creator": null,
|
204
|
-
"resource_uri": "/1.0/repositories/dmexe/vx-binutils"
|
205
|
-
}
|
206
|
-
]
|