Merge branch 'authz' of https://github.com/rubyforgood/openstreetmap-website into...
[rails.git] / test / test_helper.rb
index 83cf909dd94f208c5b89c20e024f8e6941e040f4..b7b93455206e1fb5d01090cdec53b5bca27f94f9 100644 (file)
@@ -87,6 +87,16 @@ module ActiveSupport
       @request.env["HTTP_AUTHORIZATION"] = format("Basic %{auth}", :auth => Base64.encode64("#{user}:#{pass}"))
     end
 
+    ##
+    # set oauth token permissions
+    def grant_oauth_token(*tokens)
+      request.env["oauth.token"] = AccessToken.new do |token|
+        tokens.each do |t|
+          token.public_send("#{t}=", true)
+        end
+      end
+    end
+
     ##
     # set request readers to ask for a particular error format
     def error_format(format)