Small improvement.

This commit is contained in:
Martin Edenhofer 2015-08-16 01:27:45 +02:00
parent 4655039cd1
commit a6df782fef
2 changed files with 22 additions and 0 deletions

View file

@ -50,6 +50,17 @@ class PackagesControllerTest < ActionDispatch::IntegrationTest
end
test 'packages index with nobody' do
# index
get '/api/v1/packages'
assert_response(401)
result = JSON.parse(@response.body)
assert_equal(result.class, Hash)
assert_not(result['packages'])
end
test 'packages index with admin' do
credentials = ActionController::HttpAuthentication::Basic.encode_credentials('packages-admin@example.com', 'adminpw')

View file

@ -50,6 +50,17 @@ class SettingsControllerTest < ActionDispatch::IntegrationTest
end
test 'settings index with nobody' do
# index
get '/api/v1/settings'
assert_response(401)
result = JSON.parse(@response.body)
assert_equal(result.class, Hash)
assert_not(result['settings'])
end
test 'settings index with admin' do
credentials = ActionController::HttpAuthentication::Basic.encode_credentials('packages-admin@example.com', 'adminpw')