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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54d71cae077981d1705c726931668bf9b2340cb9
4
- data.tar.gz: c0dea00e6d39a55757f96b6bd6bc6cb9e4428182
3
+ metadata.gz: ee74c22f7e23a99b63146371054be5de0129c869
4
+ data.tar.gz: e6ccec32fb14ac0ed95f2908dd656c9f57d24506
5
5
  SHA512:
6
- metadata.gz: bbb12a18dd04bb71320c037805d831f1e809fbe32b0d91055dfdcbd4287b6fd395dacb32fc67df1509f4654c0b19af8910f02b3bfc323f79910d4affc54d82da
7
- data.tar.gz: 07315c7f4b03f472551857bbda073f7a8c934dce4fe324b15730194243fc5dd4d7de0fcf72089c08bf3ba34dca0e97d6ee9d7f9f2a33f2f8ee5339bb293a5fce
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}/#{name}.git",
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
 
@@ -55,7 +55,7 @@ module Vx
55
55
 
56
56
  def response!(res)
57
57
  if (200..204).include?(res.code.to_i)
58
- if res.header['Content-Type'].include?("application/json")
58
+ if res.header['Content-Type'].to_s.include?("application/json")
59
59
  ::JSON.parse(res.body)
60
60
  else
61
61
  res.body
@@ -1,5 +1,5 @@
1
1
  module Vx
2
2
  module ServiceConnector
3
- VERSION = "0.2.13"
3
+ VERSION = "0.2.14"
4
4
  end
5
5
  end
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "teams": {
3
3
  "team1": "admin",
4
- "team2": "admin"
4
+ "121111foobar": "admin"
5
5
  }
6
- }
6
+ }
@@ -4,7 +4,7 @@ describe Vx::ServiceConnector::Bitbucket do
4
4
 
5
5
  include BitbucketWebMocks
6
6
 
7
- let(:login) { '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 "Fix all the bugs"
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 'master'
29
- expect(c.branch_label).to eq 'master'
30
- expect(c.sha).to eq '0a1fb3a24b8ceb48a16fb09a5759cd6f8a930463'
31
- expect(c.author).to eq 'login'
32
- expect(c.author_email).to eq 'example@gmail.com'
33
- expect(c.web_url).to eq 'https://bitbucket.org/login/api-test/commits/0a1fb3a24b8ceb48a16fb09a5759cd6f8a930463'
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(2).item }
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
- [["{b890dc44-b05d-4e0b-a0a4-6b5946e31603}",
55
- "login/res", false,
56
- "ssh://git@bitbucket.org/login/res.git",
57
- "https://bitbucket.org/login/res",
58
- "This your first repo!"],
59
- ["{7f4500f2-d3a7-4757-9f92-709d5976720c}",
60
- "login/api-test", false,
61
- "ssh://git@bitbucket.org/login/api-test.git",
62
- "https://bitbucket.org/login/api-test",
63
- "repo for test api"]]
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", 'commits'
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", "user_repos"
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
- "{\"label\":\"octocat@octomac\",\"key\":\"public key\"}",
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.13
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