| ... | @@ -47,6 +47,7 @@ describe Gitlab::API do |
... | @@ -47,6 +47,7 @@ describe Gitlab::API do |
|
|
response.status.should == 401
|
|
response.status.should == 401
|
|
|
end
|
|
end
|
|
|
end
|
|
end
|
|
|
|
|
|
|
context "when authenticated" do
|
|
context "when authenticated" do
|
|
|
it "should return array of ssh keys" do
|
|
it "should return array of ssh keys" do
|
|
|
user.keys << key
|
|
user.keys << key
|
| ... | @@ -67,6 +68,7 @@ describe Gitlab::API do |
... | @@ -67,6 +68,7 @@ describe Gitlab::API do |
|
|
response.status.should == 200
|
|
response.status.should == 200
|
|
|
json_response["title"].should == key.title
|
|
json_response["title"].should == key.title
|
|
|
end
|
|
end
|
|
|
|
|
|
|
it "should return 404 Not Found within invalid ID" do
|
|
it "should return 404 Not Found within invalid ID" do
|
|
|
get api("/user/keys/42", user)
|
|
get api("/user/keys/42", user)
|
|
|
response.status.should == 404
|
|
response.status.should == 404
|
| ... | @@ -78,6 +80,7 @@ describe Gitlab::API do |
... | @@ -78,6 +80,7 @@ describe Gitlab::API do |
|
|
post api("/user/keys", user), { title: "invalid key" }
|
|
post api("/user/keys", user), { title: "invalid key" }
|
|
|
response.status.should == 404
|
|
response.status.should == 404
|
|
|
end
|
|
end
|
|
|
|
|
|
|
it "should create ssh key" do
|
|
it "should create ssh key" do
|
|
|
key_attrs = Factory.attributes :key
|
|
key_attrs = Factory.attributes :key
|
|
|
expect {
|
|
expect {
|
| ... | @@ -94,6 +97,7 @@ describe Gitlab::API do |
... | @@ -94,6 +97,7 @@ describe Gitlab::API do |
|
|
delete api("/user/keys/#{key.id}", user)
|
|
delete api("/user/keys/#{key.id}", user)
|
|
|
}.to change{user.keys.count}.by(-1)
|
|
}.to change{user.keys.count}.by(-1)
|
|
|
end
|
|
end
|
|
|
|
|
|
|
it "should return 404 Not Found within invalid ID" do
|
|
it "should return 404 Not Found within invalid ID" do
|
|
|
delete api("/user/keys/42", user)
|
|
delete api("/user/keys/42", user)
|
|
|
response.status.should == 404
|
|
response.status.should == 404
|
| ... | |
... | |
| ... | | ... | |