From: Ronelle Landy <[email protected]>
---
tests/cimi/test_helper.rb | 23 +++++++++++++----------
tests/config.yaml | 18 +++++++-----------
2 files changed, 20 insertions(+), 21 deletions(-)
diff --git a/tests/cimi/test_helper.rb b/tests/cimi/test_helper.rb
index 025a705..ad74cd2 100644
--- a/tests/cimi/test_helper.rb
+++ b/tests/cimi/test_helper.rb
@@ -32,12 +32,19 @@ module CIMI
include Singleton
def initialize
- @hash = Deltacloud::Test::yaml_config
- @cimi = @hash["cimi"]
+ @hash = Deltacloud::Test::yaml_config
+ end
+
+ def driver
+ xml.xpath("/c:CloudEntryPoint/c:name", ns).text
+ end
+
+ def preferred
+ @hash[driver]["preferred"] || {}
end
def cep_url
- @cimi["cep"]
+ @hash["cep"]
end
def base_uri
@@ -45,23 +52,19 @@ module CIMI
end
def basic_auth(u = nil, p = nil)
- u ||= @cimi["user"]
- p ||= @cimi["password"]
+ u ||= @hash[driver]["user"]
+ p ||= @hash[driver]["password"]
"Basic #{Base64.encode64("#{u}:#{p}")}"
end
def auth_header
- if @cimi["user"]
+ if @hash[driver]["user"]
{ "Authorization" => basic_auth }
else
{}
end
end
- def preferred
- @cimi["preferred"] || {}
- end
-
def collections
xml.xpath("/c:CloudEntryPoint/c:*[@href]", ns).map { |c| c.name.to_sym
}
end
diff --git a/tests/config.yaml b/tests/config.yaml
index b567923..e7b1b88 100644
--- a/tests/config.yaml
+++ b/tests/config.yaml
@@ -1,9 +1,16 @@
---
+# DELTACLOUD API TESTING
api_url: "http://localhost:3001/api"
+# CIMI TESTING
+cep: "http://localhost:3001/cimi/cloudEntryPoint"
#MOCK DRIVER CONFIG:
mock:
user: "mockuser"
password: "mockpassword"
+ preferred:
+ machineImage: "img2"
+ machineConfig: "m1-small"
+ volumeConfig: "2"
#OPENSTACK DRIVER CONFIG
openstack:
user:
@@ -39,14 +46,3 @@ fgcp:
image: "IMG_3c9820_D30U8UNY6I9S"
hardware_profile: "economy"
realm: "UZXC0GRT-ZG8ZJCJ07"
-
-
-# CIMI testing
-cimi:
- cep: "http://localhost:3001/cimi/cloudEntryPoint"
- user: "mockuser"
- password: "mockpassword"
- preferred:
- machineImage: "img2"
- machineConfig: "m1-small"
- volumeConfig: "2"
--
1.7.7.6