]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/users_controller_test.rb
API User details: format tweaks
[rails.git] / test / controllers / api / users_controller_test.rb
index 2824c40b28a626a6c9cf264d00b7fad7a00aeb3e..5ce30d6a614f4e7f3d84cd5c2af2aaf675f56ac8 100644 (file)
@@ -81,6 +81,15 @@ module Api
       # check that a non-existent user is not returned
       get api_user_path(:id => 0)
       assert_response :not_found
+
+      # check that a visible user is returned properly in json
+      get api_user_path(:id => user.id, :format => "json")
+      assert_response :success
+      assert_equal "application/json", response.media_type
+
+      js = ActiveSupport::JSON.decode(@response.body)
+      assert_not_nil js
+      assert_equal user.id, js["user"]["id"]
     end
 
     def test_details