summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/api/session.md5
-rw-r--r--spec/requests/api/session_spec.rb10
2 files changed, 15 insertions, 0 deletions
diff --git a/doc/api/session.md b/doc/api/session.md
index c7e57aaca7a..5f49d989967 100644
--- a/doc/api/session.md
+++ b/doc/api/session.md
@@ -21,3 +21,8 @@ Parameters:
"blocked": true
}
```
+
+Return values:
+
++ `201 Created` on success
++ `401 Unauthorized` if the authentication process failed, e.g. invalid password or attribute not given
diff --git a/spec/requests/api/session_spec.rb b/spec/requests/api/session_spec.rb
index afae8be8cbc..2cdb0d7e9b4 100644
--- a/spec/requests/api/session_spec.rb
+++ b/spec/requests/api/session_spec.rb
@@ -35,5 +35,15 @@ describe Gitlab::API do
json_response['private_token'].should be_nil
end
end
+
+ context "when empty name" do
+ it "should return authentication error" do
+ post api("/session"), password: user.password
+ response.status.should == 401
+
+ json_response['email'].should be_nil
+ json_response['private_token'].should be_nil
+ end
+ end
end
end