Commit dffc2b8a8b3ed03f12dc8f41a6f24b96f2605268

Authored by Sebastian Ziebell
1 parent 873db062

API: session documentation updated and test added

doc/api/session.md
@@ -21,3 +21,8 @@ Parameters: @@ -21,3 +21,8 @@ Parameters:
21 "blocked": true 21 "blocked": true
22 } 22 }
23 ``` 23 ```
  24 +
  25 +Return values:
  26 +
  27 ++ `201 Created` on success
  28 ++ `401 Unauthorized` if the authentication process failed, e.g. invalid password or attribute not given
spec/requests/api/session_spec.rb
@@ -35,5 +35,15 @@ describe Gitlab::API do @@ -35,5 +35,15 @@ describe Gitlab::API do
35 json_response['private_token'].should be_nil 35 json_response['private_token'].should be_nil
36 end 36 end
37 end 37 end
  38 +
  39 + context "when empty name" do
  40 + it "should return authentication error" do
  41 + post api("/session"), password: user.password
  42 + response.status.should == 401
  43 +
  44 + json_response['email'].should be_nil
  45 + json_response['private_token'].should be_nil
  46 + end
  47 + end
38 end 48 end
39 end 49 end