summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-27 12:58:06 +0100
committerSebastian Ziebell <sebastian.ziebell@asquera.de>2013-02-27 12:58:06 +0100
commitdffc2b8a8b3ed03f12dc8f41a6f24b96f2605268 (patch)
treea7a803fe6a6c2e2324c423d129119d109a83610d
parent873db06255eae1f69644c2a0815b88c923021c8f (diff)
downloadgitlab-ce-dffc2b8a8b3ed03f12dc8f41a6f24b96f2605268.tar.gz
API: session documentation updated and test added
-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