diff options
author | Pablo Carranza <pcarranza@gmail.com> | 2016-03-07 12:43:19 +0000 |
---|---|---|
committer | Pablo Carranza <pcarranza@gmail.com> | 2016-03-24 20:48:27 +0000 |
commit | 1f2bef765d8aa03b76f991178cfa7513833b4c3b (patch) | |
tree | 4f8653ace8b2290687d3b02dec9910923a1f6f3f /spec/gitlab_net_spec.rb | |
parent | f63e1bfcf508d9ed3c0e60399960f1c1cf21d899 (diff) | |
download | gitlab-shell-1f2bef765d8aa03b76f991178cfa7513833b4c3b.tar.gz |
Add ssh-key resource get to gitlab_net
This provides the integration point to the internal API to get the
ssh key from the internal API.
Diffstat (limited to 'spec/gitlab_net_spec.rb')
-rw-r--r-- | spec/gitlab_net_spec.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/gitlab_net_spec.rb b/spec/gitlab_net_spec.rb index 9a166b5..964e398 100644 --- a/spec/gitlab_net_spec.rb +++ b/spec/gitlab_net_spec.rb @@ -76,6 +76,34 @@ describe GitlabNet, vcr: true do end end + describe :ssh_key do + it "should return nil when the resource is not implemented" do + VCR.use_cassette("ssh-key-not-implemented") do + result = gitlab_net.ssh_key("whatever") + result.should be_nil + end + end + + it "should return nil when the fingerprint is not found" do + VCR.use_cassette("ssh-key-not-found") do + result = gitlab_net.ssh_key("whatever") + result.should be_nil + end + end + + it "should return a ssh key with a valid fingerprint" do + VCR.use_cassette("ssh-key-ok") do + result = gitlab_net.ssh_key("42:18:16") + result.should eq({ + "created_at" => "2016-03-04T18:27:36.959Z", + "id" => 2, + "key" => "ssh-rsa a-made=up-rsa-key dummy@gitlab.com", + "title" => "some key title" + }) + end + end + end + describe :check_access do context 'ssh key with access to project' do it 'should allow pull access for dev.gitlab.org' do |