From dffc2b8a8b3ed03f12dc8f41a6f24b96f2605268 Mon Sep 17 00:00:00 2001 From: Sebastian Ziebell Date: Wed, 27 Feb 2013 12:58:06 +0100 Subject: [PATCH] API: session documentation updated and test added --- doc/api/session.md | 5 +++++ spec/requests/api/session_spec.rb | 10 ++++++++++ 2 files changed, 15 insertions(+) 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