diff options
author | Valery Sizov <valery@gitlab.com> | 2014-10-15 16:09:35 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2014-10-15 16:09:35 +0300 |
commit | e981f4eb491c286dee7e13c3c9e1275d4c46cfd6 (patch) | |
tree | e90d28c248856a7753033ddf6e4131068313a63a /spec/gitlab_net_spec.rb | |
parent | d01eac99bf7027258f7bb1196bf1020cb6b5206b (diff) | |
download | gitlab-shell-secret_token.tar.gz |
add secret tokensecret_token
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r-- | spec/gitlab_net_spec.rb | 22 |
1 files changed, 22 insertions, 0 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) |