summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorValery Sizov <valery@gitlab.com>2014-10-15 16:09:35 +0300
committerValery Sizov <valery@gitlab.com>2014-10-15 16:09:35 +0300
commite981f4eb491c286dee7e13c3c9e1275d4c46cfd6 (patch)
treee90d28c248856a7753033ddf6e4131068313a63a /spec
parentd01eac99bf7027258f7bb1196bf1020cb6b5206b (diff)
downloadgitlab-shell-secret_token.tar.gz
add secret tokensecret_token
Diffstat (limited to 'spec')
-rw-r--r--spec/gitlab_net_spec.rb22
-rw-r--r--spec/vcr_cassettes/allowed-pull.yml2
-rw-r--r--spec/vcr_cassettes/allowed-push.yml2
-rw-r--r--spec/vcr_cassettes/check-ok.yml2
-rw-r--r--spec/vcr_cassettes/denied-pull.yml2
-rw-r--r--spec/vcr_cassettes/denied-push-with-user.yml2
-rw-r--r--spec/vcr_cassettes/denied-push.yml2
-rw-r--r--spec/vcr_cassettes/discover-ok.yml2
8 files changed, 29 insertions, 7 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb
index 6b0b65a..b62e2c6 100644
--- a/spec/gitlab_net_spec.rb
+++ b/spec/gitlab_net_spec.rb
@@ -8,6 +8,7 @@ describe GitlabNet, vcr: true do
before do
gitlab_net.stub!(:host).and_return('https://dev.gitlab.org/api/v3/internal')
+ gitlab_net.stub!(:secret_token).and_return('a123')
end
describe :check do
@@ -17,6 +18,13 @@ describe GitlabNet, vcr: true do
result.code.should == '200'
end
end
+
+ it 'adds the secret_token to request' do
+ VCR.use_cassette("check-ok") do
+ Net::HTTP::Get.any_instance.should_receive(:set_form_data).with(hash_including(secret_token: 'a123'))
+ gitlab_net.check
+ end
+ end
end
describe :discover do
@@ -26,6 +34,13 @@ describe GitlabNet, vcr: true do
user['name'].should == 'Dmitriy Zaporozhets'
end
end
+
+ it 'adds the secret_token to request' do
+ VCR.use_cassette("discover-ok") do
+ Net::HTTP::Get.any_instance.should_receive(:set_form_data).with(hash_including(secret_token: 'a123'))
+ gitlab_net.discover('key-126')
+ end
+ end
end
describe :allowed? do
@@ -37,6 +52,13 @@ describe GitlabNet, vcr: true do
end
end
+ it 'adds the secret_token theo request' do
+ VCR.use_cassette("allowed-pull") do
+ Net::HTTP::Post.any_instance.should_receive(:set_form_data).with(hash_including(secret_token: 'a123'))
+ gitlab_net.allowed?('git-receive-pack', 'gitlab/gitlabhq.git', 'key-126', changes)
+ 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', changes)
diff --git a/spec/vcr_cassettes/allowed-pull.yml b/spec/vcr_cassettes/allowed-pull.yml
index 29a0ac6..337b00f 100644
--- a/spec/vcr_cassettes/allowed-pull.yml
+++ b/spec/vcr_cassettes/allowed-pull.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/allowed
body:
encoding: US-ASCII
- string: action=git-receive-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=126
+ string: action=git-receive-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=126&secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
diff --git a/spec/vcr_cassettes/allowed-push.yml b/spec/vcr_cassettes/allowed-push.yml
index 5d19db8..cb757bf 100644
--- a/spec/vcr_cassettes/allowed-push.yml
+++ b/spec/vcr_cassettes/allowed-push.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/allowed
body:
encoding: US-ASCII
- string: action=git-upload-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=126
+ string: action=git-upload-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=126&secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
diff --git a/spec/vcr_cassettes/check-ok.yml b/spec/vcr_cassettes/check-ok.yml
index 641c6ce..1ba8b04 100644
--- a/spec/vcr_cassettes/check-ok.yml
+++ b/spec/vcr_cassettes/check-ok.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/check
body:
encoding: US-ASCII
- string: ''
+ string: secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
diff --git a/spec/vcr_cassettes/denied-pull.yml b/spec/vcr_cassettes/denied-pull.yml
index 505ce97..9941e70 100644
--- a/spec/vcr_cassettes/denied-pull.yml
+++ b/spec/vcr_cassettes/denied-pull.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/allowed
body:
encoding: US-ASCII
- string: action=git-receive-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=2
+ string: action=git-receive-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=2&secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
diff --git a/spec/vcr_cassettes/denied-push-with-user.yml b/spec/vcr_cassettes/denied-push-with-user.yml
index adca071..4694797 100644
--- a/spec/vcr_cassettes/denied-push-with-user.yml
+++ b/spec/vcr_cassettes/denied-push-with-user.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/allowed
body:
encoding: US-ASCII
- string: action=git-upload-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&user_id=1
+ string: action=git-upload-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&user_id=1&secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
diff --git a/spec/vcr_cassettes/denied-push.yml b/spec/vcr_cassettes/denied-push.yml
index 2b0bfea..fc0a309 100644
--- a/spec/vcr_cassettes/denied-push.yml
+++ b/spec/vcr_cassettes/denied-push.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/allowed
body:
encoding: US-ASCII
- string: action=git-upload-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=2
+ string: action=git-upload-pack&changes=0000000000000000000000000000000000000000+92d0970eefd7acb6d548878925ce2208cfe2d2ec+refs%2Fheads%2Fbranch4&project=gitlab%2Fgitlabhq&key_id=2&secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
diff --git a/spec/vcr_cassettes/discover-ok.yml b/spec/vcr_cassettes/discover-ok.yml
index 982065a..a86243c 100644
--- a/spec/vcr_cassettes/discover-ok.yml
+++ b/spec/vcr_cassettes/discover-ok.yml
@@ -5,7 +5,7 @@ http_interactions:
uri: https://dev.gitlab.org/api/v3/internal/discover?key_id=126
body:
encoding: US-ASCII
- string: ''
+ string: secret_token=a123
headers:
Accept-Encoding:
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3