summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-01 19:25:59 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-01 19:25:59 +0300
commita71c80721de28e59147dc6b8c8326c98570a1cb8 (patch)
treee5e020d921f454b1f61b903e76e31d37a5ffaeb4 /spec
parent2198fa631a41261e7555bf0dd626bf25a3993017 (diff)
downloadgitlab-shell-a71c80721de28e59147dc6b8c8326c98570a1cb8.tar.gz
Update GitlabNet to match new logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_net_spec.rb11
-rw-r--r--spec/vcr_cassettes/allowed-pull.yml10
-rw-r--r--spec/vcr_cassettes/allowed-push.yml10
-rw-r--r--spec/vcr_cassettes/check-ok.yml12
-rw-r--r--spec/vcr_cassettes/denied-pull.yml10
-rw-r--r--spec/vcr_cassettes/denied-push-with-user.yml24
-rw-r--r--spec/vcr_cassettes/denied-push.yml10
-rw-r--r--spec/vcr_cassettes/discover-ok.yml8
8 files changed, 49 insertions, 46 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index 1b7ef4d..6b0b65a 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -4,6 +4,7 @@ require_relative '../lib/gitlab_net'
describe GitlabNet, vcr: true do
let(:gitlab_net) { GitlabNet.new }
+ let(:changes) { ['0000000000000000000000000000000000000000 92d0970eefd7acb6d548878925ce2208cfe2d2ec refs/heads/branch4'] }
before do
gitlab_net.stub!(:host).and_return('https://dev.gitlab.org/api/v3/internal')
@@ -31,14 +32,14 @@ describe GitlabNet, vcr: true do
context 'ssh key with access to project' do
it 'should allow pull access for dev.gitlab.org' do
VCR.use_cassette("allowed-pull") do
- access = gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-126', 'master')
+ access = gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-126', changes)
access.should be_true
end
end
it 'should allow push access for dev.gitlab.org' do
VCR.use_cassette("allowed-push") do
- access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'key-126', 'master')
+ access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'key-126', changes)
access.should be_true
end
end
@@ -47,21 +48,21 @@ describe GitlabNet, vcr: true do
context 'ssh key without access to project' do
it 'should deny pull access for dev.gitlab.org' do
VCR.use_cassette("denied-pull") do
- access = gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-2', 'master')
+ access = gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-2', changes)
access.should be_false
end
end
it 'should deny push access for dev.gitlab.org' do
VCR.use_cassette("denied-push") do
- access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'key-2', 'master')
+ access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'key-2', changes)
access.should be_false
end
end
it 'should deny push access for dev.gitlab.org (with user)' do
VCR.use_cassette("denied-push-with-user") do
- access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'user-1', 'master')
+ access = gitlab_net.allowed?('git-upload-pack', 'gitlab/gitlabhq.git', 'user-1', changes)
access.should be_false
end
end
diff --git a/spec/vcr_cassettes/allowed-pull.yml b/spec/vcr_cassettes/allowed-pull.yml
index af17288..469e4f0 100644
--- a/spec/vcr_cassettes/allowed-pull.yml
+++ b/spec/vcr_cassettes/allowed-pull.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: get
- uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-receive-pack&forced_push=false&key_id=126&project=gitlab/gitlabhq&ref=master
+ uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-receive-pack&changes=0000000000000000000000000000000000000000%2092d0970eefd7acb6d548878925ce2208cfe2d2ec%20refs/heads/branch4&key_id=126&project=gitlab/gitlabhq
body:
encoding: US-ASCII
string: ''
@@ -21,7 +21,7 @@ http_interactions:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:53 GMT
+ - Mon, 01 Sep 2014 16:23:50 GMT
Content-Type:
- application/json
Content-Length:
@@ -35,12 +35,12 @@ http_interactions:
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- - b049c014-05c4-4ec7-a591-1b0661257e33
+ - 677dee49-79ab-452b-a56c-bb656949dab1
X-Runtime:
- - '0.055486'
+ - '0.079772'
body:
encoding: UTF-8
string: 'true'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:53 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:50 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/allowed-push.yml b/spec/vcr_cassettes/allowed-push.yml
index fe50302..e82a383 100644
--- a/spec/vcr_cassettes/allowed-push.yml
+++ b/spec/vcr_cassettes/allowed-push.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: get
- uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-upload-pack&forced_push=false&key_id=126&project=gitlab/gitlabhq&ref=master
+ uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-upload-pack&changes=0000000000000000000000000000000000000000%2092d0970eefd7acb6d548878925ce2208cfe2d2ec%20refs/heads/branch4&key_id=126&project=gitlab/gitlabhq
body:
encoding: US-ASCII
string: ''
@@ -21,7 +21,7 @@ http_interactions:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:54 GMT
+ - Mon, 01 Sep 2014 16:23:51 GMT
Content-Type:
- application/json
Content-Length:
@@ -35,12 +35,12 @@ http_interactions:
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- - 7f92ebb7-4f92-4236-a35a-5f15c59b81f8
+ - 598daf73-57a1-4861-b159-fdfa2cbb3cfc
X-Runtime:
- - '0.060724'
+ - '0.033789'
body:
encoding: UTF-8
string: 'true'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:54 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:51 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/check-ok.yml b/spec/vcr_cassettes/check-ok.yml
index 5486697..0f782a8 100644
--- a/spec/vcr_cassettes/check-ok.yml
+++ b/spec/vcr_cassettes/check-ok.yml
@@ -21,7 +21,7 @@ http_interactions:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:52 GMT
+ - Mon, 01 Sep 2014 16:23:48 GMT
Content-Type:
- application/json
Content-Length:
@@ -31,16 +31,16 @@ http_interactions:
Status:
- 200 OK
Etag:
- - '"263db4ad138ffbada1f94332a1a2e1e8"'
+ - '"4deef8ced16c13af425359a8f45f42e1"'
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- - 17b6ff1c-e1a5-4443-b053-74cfced03184
+ - 041c17df-8c96-4633-9063-d309583fe0fa
X-Runtime:
- - '0.004863'
+ - '0.012408'
body:
encoding: UTF-8
- string: '{"api_version":"v3","gitlab_version":"6.8.0.pre","gitlab_rev":"352bb97"}'
+ string: '{"api_version":"v3","gitlab_version":"7.3.0.pre","gitlab_rev":"174c00c"}'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:52 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:48 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/denied-pull.yml b/spec/vcr_cassettes/denied-pull.yml
index 7f81ded..8c75d52 100644
--- a/spec/vcr_cassettes/denied-pull.yml
+++ b/spec/vcr_cassettes/denied-pull.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: get
- uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-receive-pack&forced_push=false&key_id=2&project=gitlab/gitlabhq&ref=master
+ uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-receive-pack&changes=0000000000000000000000000000000000000000%2092d0970eefd7acb6d548878925ce2208cfe2d2ec%20refs/heads/branch4&key_id=2&project=gitlab/gitlabhq
body:
encoding: US-ASCII
string: ''
@@ -21,7 +21,7 @@ http_interactions:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:54 GMT
+ - Mon, 01 Sep 2014 16:23:52 GMT
Content-Type:
- application/json
Content-Length:
@@ -33,12 +33,12 @@ http_interactions:
Cache-Control:
- no-cache
X-Request-Id:
- - 7eb4f49d-66a6-4cca-84dd-9dfcd431210a
+ - 1721b961-9792-4af4-b3d2-fff0f7aa33b7
X-Runtime:
- - '0.010216'
+ - '0.034322'
body:
encoding: UTF-8
string: '{"message":"404 Not found"}'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:54 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:52 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/denied-push-with-user.yml b/spec/vcr_cassettes/denied-push-with-user.yml
index c3e5b60..4cd086a 100644
--- a/spec/vcr_cassettes/denied-push-with-user.yml
+++ b/spec/vcr_cassettes/denied-push-with-user.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: get
- uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-upload-pack&forced_push=false&project=gitlab/gitlabhq&ref=master&user_id=1
+ uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-upload-pack&changes=0000000000000000000000000000000000000000%2092d0970eefd7acb6d548878925ce2208cfe2d2ec%20refs/heads/branch4&project=gitlab/gitlabhq&user_id=1
body:
encoding: US-ASCII
string: ''
@@ -15,30 +15,32 @@ http_interactions:
- Ruby
response:
status:
- code: 404
- message: Not Found
+ code: 200
+ message: OK
headers:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:54 GMT
+ - Mon, 01 Sep 2014 16:23:52 GMT
Content-Type:
- application/json
Content-Length:
- - '27'
+ - '4'
Connection:
- keep-alive
Status:
- - 404 Not Found
+ - 200 OK
+ Etag:
+ - '"b326b5062b2f0e69046810717534cb09"'
Cache-Control:
- - no-cache
+ - max-age=0, private, must-revalidate
X-Request-Id:
- - 2a2a3ef9-aaf1-4ffb-8b18-475d52ec5e09
+ - 1222ecfc-c1af-4246-b63f-f3f2865c4813
X-Runtime:
- - '0.013223'
+ - '0.031859'
body:
encoding: UTF-8
- string: '{"message":"404 Not found"}'
+ string: 'false'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:54 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:52 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/denied-push.yml b/spec/vcr_cassettes/denied-push.yml
index ca1569d..9c05962 100644
--- a/spec/vcr_cassettes/denied-push.yml
+++ b/spec/vcr_cassettes/denied-push.yml
@@ -2,7 +2,7 @@
http_interactions:
- request:
method: get
- uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-upload-pack&forced_push=false&key_id=2&project=gitlab/gitlabhq&ref=master
+ uri: https://dev.gitlab.org/api/v3/internal/allowed?action=git-upload-pack&changes=0000000000000000000000000000000000000000%2092d0970eefd7acb6d548878925ce2208cfe2d2ec%20refs/heads/branch4&key_id=2&project=gitlab/gitlabhq
body:
encoding: US-ASCII
string: ''
@@ -21,7 +21,7 @@ http_interactions:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:54 GMT
+ - Mon, 01 Sep 2014 16:23:52 GMT
Content-Type:
- application/json
Content-Length:
@@ -33,12 +33,12 @@ http_interactions:
Cache-Control:
- no-cache
X-Request-Id:
- - 2a2a3ef9-aaf1-4ffb-8b18-475d52ec5e09
+ - fbaed080-e60e-4893-afe3-4f0c331b1983
X-Runtime:
- - '0.013223'
+ - '0.013659'
body:
encoding: UTF-8
string: '{"message":"404 Not found"}'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:54 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:52 GMT
recorded_with: VCR 2.4.0
diff --git a/spec/vcr_cassettes/discover-ok.yml b/spec/vcr_cassettes/discover-ok.yml
index 9609dec..0cb28ec 100644
--- a/spec/vcr_cassettes/discover-ok.yml
+++ b/spec/vcr_cassettes/discover-ok.yml
@@ -21,7 +21,7 @@ http_interactions:
Server:
- nginx/1.1.19
Date:
- - Mon, 14 Apr 2014 18:25:53 GMT
+ - Mon, 01 Sep 2014 16:23:49 GMT
Content-Type:
- application/json
Content-Length:
@@ -35,12 +35,12 @@ http_interactions:
Cache-Control:
- max-age=0, private, must-revalidate
X-Request-Id:
- - c3d44ccc-7599-4cc1-879e-281894f9cb39
+ - f0ec702f-ff68-4597-a386-b7ff4bae5650
X-Runtime:
- - '0.010799'
+ - '0.935522'
body:
encoding: UTF-8
string: '{"name":"Dmitriy Zaporozhets","username":"dzaporozhets"}'
http_version:
- recorded_at: Mon, 14 Apr 2014 18:25:53 GMT
+ recorded_at: Mon, 01 Sep 2014 16:23:49 GMT
recorded_with: VCR 2.4.0