Commit 5e35f21605a15414258c5a857f75679f9df2c102
1 parent
79bea312
Exists in
master
and in
4 other branches
allow all git-upload-* commands for deploy keys
Showing
2 changed files
with
37 additions
and
1 deletions
Show diff stats
lib/api/internal.rb
spec/requests/api/internal_spec.rb
| ... | ... | @@ -100,6 +100,32 @@ describe API::API do |
| 100 | 100 | end |
| 101 | 101 | end |
| 102 | 102 | end |
| 103 | + | |
| 104 | + context "deploy key" do | |
| 105 | + let(:key) { create(:deploy_key) } | |
| 106 | + | |
| 107 | + context "added to project" do | |
| 108 | + before do | |
| 109 | + key.projects << project | |
| 110 | + end | |
| 111 | + | |
| 112 | + it do | |
| 113 | + archive(key, project) | |
| 114 | + | |
| 115 | + response.status.should == 200 | |
| 116 | + response.body.should == 'true' | |
| 117 | + end | |
| 118 | + end | |
| 119 | + | |
| 120 | + context "not added to project" do | |
| 121 | + it do | |
| 122 | + archive(key, project) | |
| 123 | + | |
| 124 | + response.status.should == 200 | |
| 125 | + response.body.should == 'false' | |
| 126 | + end | |
| 127 | + end | |
| 128 | + end | |
| 103 | 129 | end |
| 104 | 130 | |
| 105 | 131 | def pull(key, project) |
| ... | ... | @@ -121,4 +147,14 @@ describe API::API do |
| 121 | 147 | action: 'git-receive-pack' |
| 122 | 148 | ) |
| 123 | 149 | end |
| 150 | + | |
| 151 | + def archive(key, project) | |
| 152 | + get( | |
| 153 | + api("/internal/allowed"), | |
| 154 | + ref: 'master', | |
| 155 | + key_id: key.id, | |
| 156 | + project: project.path_with_namespace, | |
| 157 | + action: 'git-upload-archive' | |
| 158 | + ) | |
| 159 | + end | |
| 124 | 160 | end | ... | ... |