X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/541c24b23d09917dc841c51ea6225c76bc074c0b..c76e60f052051a35fe7e9044969337cd88e5b1fd:/test/functional/user_preference_controller_test.rb?ds=sidebyside diff --git a/test/functional/user_preference_controller_test.rb b/test/functional/user_preference_controller_test.rb index 7ff64b30e..ff44c1e36 100644 --- a/test/functional/user_preference_controller_test.rb +++ b/test/functional/user_preference_controller_test.rb @@ -1,8 +1,26 @@ require File.dirname(__FILE__) + '/../test_helper' class UserPreferenceControllerTest < ActionController::TestCase - # Replace this with your real tests. - def test_truth - assert true + fixtures :users, :user_preferences + + def test_read + # first try without auth + get :read + assert_response :unauthorized, "should be authenticated" + + # now set the auth + basic_authorization("test@openstreetmap.org", "test") + + get :read + assert_response :success + print @response.body + assert_select "osm:root" do + assert_select "preferences", :count => 1 do + assert_select "preference", :count => 2 + assert_select "preference[k=\"#{user_preferences(:a).k}\"][v=\"#{user_preferences(:a).v}\"]", :count => 1 + assert_select "preference[k=\"#{user_preferences(:two).k}\"][v=\"#{user_preferences(:two).v}\"]", :count => 1 + end + end end + end