Browse Source

Small improvement.

Martin Edenhofer 9 years ago
parent
commit
a6df782fef

+ 11 - 0
test/controllers/packages_controller_test.rb

@@ -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')

+ 11 - 0
test/controllers/settings_controller_test.rb

@@ -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')