deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [24/31] git commit: * deltacloud/test_setup.rb: extract url/param processing from get
Date Wed, 25 Jul 2012 13:56:38 GMT
* deltacloud/test_setup.rb: extract url/param processing from get


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/f76ebc23
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/f76ebc23
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/f76ebc23

Branch: refs/heads/master
Commit: f76ebc23ceb98cbf654821778215b81a9f35d926
Parents: 783a914
Author: David Lutterkort <lutter@redhat.com>
Authored: Fri Jul 20 17:18:22 2012 -0700
Committer: marios <marios@redhat.com>
Committed: Tue Jul 24 12:01:36 2012 +0300

----------------------------------------------------------------------
 tests/deltacloud/test_setup.rb |   50 +++++++++++++++++++---------------
 1 files changed, 28 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f76ebc23/tests/deltacloud/test_setup.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/test_setup.rb b/tests/deltacloud/test_setup.rb
index a46c1e7..b74b785 100644
--- a/tests/deltacloud/test_setup.rb
+++ b/tests/deltacloud/test_setup.rb
@@ -61,6 +61,33 @@ end
 # If none of the auth relevant params are set, use the username and
 # password for the current driver from the config
 def get(path, params={})
+  url, headers = process_url_params(path, params)
+  RestClient.get url, headers
+end
+
+def post(post_body = "", path= "", params={}, authenticate = false)
+  if authenticate
+    params.merge!({:Authorization=>BASIC_AUTH})
+  end
+  RestClient.post API_URL+path, post_body, params
+end
+
+def delete(params={}, path = "", authenticate = true)
+  if authenticate
+    params.merge!({:Authorization=>BASIC_AUTH})
+  end
+  RestClient.delete API_URL+path, params
+end
+
+def options(params={}, path="", authenticate = false)
+  if authenticate
+    params.merge!({:Authorization=>BASIC_AUTH})
+  end
+  RestClient.options API_URL+path, params
+end
+
+# Should be private
+def process_url_params(path, params)
   path = "" if path == "/"
   headers = {}
   unless params.delete(:noauth)
@@ -86,28 +113,7 @@ def get(path, params={})
     puts "GET #{url}"
     headers.each { |k, v| puts "#{k}: #{v}" }
   end
-  RestClient.get url, headers
-end
-
-def post(post_body = "", path= "", params={}, authenticate = false)
-  if authenticate
-    params.merge!({:Authorization=>BASIC_AUTH})
-  end
-  RestClient.post API_URL+path, post_body, params
-end
-
-def delete(params={}, path = "", authenticate = true)
-  if authenticate
-    params.merge!({:Authorization=>BASIC_AUTH})
-  end
-  RestClient.delete API_URL+path, params
-end
-
-def options(params={}, path="", authenticate = false)
-  if authenticate
-    params.merge!({:Authorization=>BASIC_AUTH})
-  end
-  RestClient.options API_URL+path, params
+  [url, headers]
 end
 
 #the TEST_FILES hash and deltacloud_test_file_names method


Mime
View raw message