Return error when API user not found in REPP #2774

This commit is contained in:
Martin Lensment 2015-07-20 18:19:02 +03:00
parent 1b9bc92660
commit f2992b7f45
3 changed files with 15 additions and 0 deletions

View file

@ -77,5 +77,14 @@ describe Repp::DomainV1 do
# TODO: Log failed API requests too
end
it 'returns an error with invalid credentials' do
invalid_user = OpenStruct.new(username: 'bla', password: 'blabala')
get_with_auth '/repp/v1/domains', {}, invalid_user
response.status.should == 401
body = JSON.parse(response.body)
body['error'].should == 'API user not found'
end
end
end