You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by dk...@apache.org on 2013/02/18 13:54:26 UTC
[1/4] FGCP: added unit tests for provider & realms,
incl. VCR recordings and fixed error with unknown id
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/fixtures/test_0004_must_include_correct_attributes.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/fixtures/test_0004_must_include_correct_attributes.yml b/server/tests/drivers/fgcp/fixtures/test_0004_must_include_correct_attributes.yml
deleted file mode 100644
index f55852c..0000000
--- a/server/tests/drivers/fgcp/fixtures/test_0004_must_include_correct_attributes.yml
+++ /dev/null
@@ -1,126 +0,0 @@
----
-recorded_with: VCR 2.4.0
-http_interactions:
-- request:
- method: get
- uri: https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?AccessKeyId=QVVTIEVhc3Rlcm4gRGF5bGlnaHQgVGltZSYxMzYxMTgyODEyMDAwJjEuMCZT%0ASEExd2l0aFJTQQ==%0A&Action=ListServerType&Locale=en&Signature=z3pBXQX53AXyyosU0Is0xAni9N61RnBi4NMw7glcGUQPlmV/rf0gB+JY/y3l%0AgDTbxCGPJ3Xg8b/PAn3YvnyMhJAiL3HaQKznsbH1wcQcS9+fZ/0x08JpWWVz%0ABHSija61OtJGbqV9Et9VamDMe4OzsAcHbWcN7KeW0P1WH5V00MbCNIZnZZBR%0Awhit8SoE2I3bzUAPgWl/M2VWqxqDwzlr6bEcBEkXUqfGis9s635T8o4gysLW%0ABoFfUaZR1f0/zlDsbRsuovWyIJYjHAZ3lJe58SxnBUS7CX2nWpi2OXThGoAr%0Aoea1NoeKFiawYDU4hIPGxlxV95D8TEIYwlIEzRRexA==%0A&Version=2011-01-31&diskImageId=dummy
- body:
- string: ""
- headers:
- Accept:
- - text/xml
- User-Agent:
- - OViSS-API-CLIENT
- response:
- status:
- code: 200
- message: OK
- headers:
- Date:
- - Mon, 18 Feb 2013 10:20:13 GMT
- Transfer-Encoding:
- - chunked
- Set-Cookie:
- - JSESSIONID=EB12E538DA934CE48CE6B699FBB2AF76; Path=/ovisspxy; Secure
- Content-Type:
- - text/xml;charset=UTF-8
- Connection:
- - close
- body:
- string: |
- <?xml version="1.0" encoding="UTF-8"?>
- <ListServerTypeResponse xmlns="http://apioviss.jp.fujitsu.com">
- <responseMessage>Processing was completed.</responseMessage>
- <responseStatus>SUCCESS</responseStatus>
- <servertypes>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>4.0</cpuPerf>
- <numOfCpu>1</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_144</id>
- <memory>
- <memorySize>7.5</memorySize>
- </memory>
- <name>advanced</name>
- <price>0.4949</price>
- <productId>AUS-VM-0001-0003</productId>
- <productName>Advanced VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>1.0</cpuPerf>
- <numOfCpu>1</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_140</id>
- <memory>
- <memorySize>1.7</memorySize>
- </memory>
- <name>economy</name>
- <price>0.1237</price>
- <productId>AUS-VM-0001-0001</productId>
- <productName>Economy VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>4.0</cpuPerf>
- <numOfCpu>2</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_146</id>
- <memory>
- <memorySize>15.0</memorySize>
- </memory>
- <name>high_performance</name>
- <price>0.9898</price>
- <productId>AUS-VM-0001-0004</productId>
- <productName>High-Performance VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>2.0</cpuPerf>
- <numOfCpu>1</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_142</id>
- <memory>
- <memorySize>3.4</memorySize>
- </memory>
- <name>standard</name>
- <price>0.2474</price>
- <productId>AUS-VM-0001-0002</productId>
- <productName>Standard VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>4.0</cpuPerf>
- <numOfCpu>4</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_146337</id>
- <memory>
- <memorySize>30.0</memorySize>
- </memory>
- <name>w_high</name>
- <price>1.9796</price>
- <productId>AUS-VM-0001-0011</productId>
- <productName>Double-High Performance VM</productName>
- </servertype>
- </servertypes>
- </ListServerTypeResponse>
-
-
- http_version:
- recorded_at: Mon, 18 Feb 2013 10:20:13 GMT
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/fixtures/test_0005_must_include_at_least_four_profiles.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/fixtures/test_0005_must_include_at_least_four_profiles.yml b/server/tests/drivers/fgcp/fixtures/test_0005_must_include_at_least_four_profiles.yml
deleted file mode 100644
index 64d78be..0000000
--- a/server/tests/drivers/fgcp/fixtures/test_0005_must_include_at_least_four_profiles.yml
+++ /dev/null
@@ -1,126 +0,0 @@
----
-recorded_with: VCR 2.4.0
-http_interactions:
-- request:
- method: get
- uri: https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?AccessKeyId=QVVTIEVhc3Rlcm4gRGF5bGlnaHQgVGltZSYxMzYxMTgyODA5MDAwJjEuMCZT%0ASEExd2l0aFJTQQ==%0A&Action=ListServerType&Locale=en&Signature=RGCovUee9Hm4ynmNvX32hwSmRSKK7IYmbSDSgRlUCCp9jDckM3toiYCVC+XN%0ANFT9RX350TzHxAf877PZQLRNmmAb1pLmtC4woiez2enurtG1KZ/iA7sflkbw%0A4Ha7PntZR4eQXztjugLlHydANO+MqaRQ0fYuzDPmGL06jbbcTn8mEVUIJhmR%0AFMnQuMks92NcPlBolXm6U93qJkTw9v1XeN+qK7vnZHShZgG12jYnJ3l0iwKG%0A2Qo2R5nZYAJKLLPwd3W+veJkTrZJ5WIdzljXESensqpLEwrbhWYLxKWf8pxq%0AGpHSLeiKYDO/y6YlrDmSgdyC9k+qKPn7EgfEOP/4Pg==%0A&Version=2011-01-31&diskImageId=dummy
- body:
- string: ""
- headers:
- Accept:
- - text/xml
- User-Agent:
- - OViSS-API-CLIENT
- response:
- status:
- code: 200
- message: OK
- headers:
- Date:
- - Mon, 18 Feb 2013 10:20:10 GMT
- Transfer-Encoding:
- - chunked
- Set-Cookie:
- - JSESSIONID=389AA2D44102AB87BF01D3769C510516; Path=/ovisspxy; Secure
- Content-Type:
- - text/xml;charset=UTF-8
- Connection:
- - close
- body:
- string: |
- <?xml version="1.0" encoding="UTF-8"?>
- <ListServerTypeResponse xmlns="http://apioviss.jp.fujitsu.com">
- <responseMessage>Processing was completed.</responseMessage>
- <responseStatus>SUCCESS</responseStatus>
- <servertypes>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>4.0</cpuPerf>
- <numOfCpu>1</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_144</id>
- <memory>
- <memorySize>7.5</memorySize>
- </memory>
- <name>advanced</name>
- <price>0.4949</price>
- <productId>AUS-VM-0001-0003</productId>
- <productName>Advanced VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>1.0</cpuPerf>
- <numOfCpu>1</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_140</id>
- <memory>
- <memorySize>1.7</memorySize>
- </memory>
- <name>economy</name>
- <price>0.1237</price>
- <productId>AUS-VM-0001-0001</productId>
- <productName>Economy VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>4.0</cpuPerf>
- <numOfCpu>2</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_146</id>
- <memory>
- <memorySize>15.0</memorySize>
- </memory>
- <name>high_performance</name>
- <price>0.9898</price>
- <productId>AUS-VM-0001-0004</productId>
- <productName>High-Performance VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>2.0</cpuPerf>
- <numOfCpu>1</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_142</id>
- <memory>
- <memorySize>3.4</memorySize>
- </memory>
- <name>standard</name>
- <price>0.2474</price>
- <productId>AUS-VM-0001-0002</productId>
- <productName>Standard VM</productName>
- </servertype>
- <servertype>
- <chargeType>amount</chargeType>
- <cpu>
- <cpuArch>IA</cpuArch>
- <cpuPerf>4.0</cpuPerf>
- <numOfCpu>4</numOfCpu>
- </cpu>
- <expectedUsage>744</expectedUsage>
- <id>islanda-cbrm_146337</id>
- <memory>
- <memorySize>30.0</memorySize>
- </memory>
- <name>w_high</name>
- <price>1.9796</price>
- <productId>AUS-VM-0001-0011</productId>
- <productName>Double-High Performance VM</productName>
- </servertype>
- </servertypes>
- </ListServerTypeResponse>
-
-
- http_version:
- recorded_at: Mon, 18 Feb 2013 10:20:10 GMT
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/fixtures/test_0005_must_include_correct_attributes.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/fixtures/test_0005_must_include_correct_attributes.yml b/server/tests/drivers/fgcp/fixtures/test_0005_must_include_correct_attributes.yml
new file mode 100644
index 0000000..77f5cbd
--- /dev/null
+++ b/server/tests/drivers/fgcp/fixtures/test_0005_must_include_correct_attributes.yml
@@ -0,0 +1,126 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?AccessKeyId=QVVTIEVhc3Rlcm4gRGF5bGlnaHQgVGltZSYxMzYxMTg4ODQzMDAwJjEuMCZT%0ASEExd2l0aFJTQQ==%0A&Action=ListServerType&Locale=en&Signature=QPI5VNNnSFlLKNzGzIh8k22JnQqPeaIqjnLodiEHcV0H/1phG9eVtKRAB76e%0AkmC7bLtxTECV5XGN4gIcsYgdFazEtVJoMQ89k9bC+/2stZ1CKLw5C1+nXfeo%0AT5t1Xixq3PvPkWPAyd1tvs6JZOxToMeUgFg9/pK26FrUIrxHub3148x8HSAB%0AYH0Jkn5fMnRhuCKOHhtfkk9lXfZOtL0aouGLA01mboBa6KfTIOMe4V7py/Fi%0AkMT28diwyagwEyjslMfRohFEMlVDCQ7V4TaBGRwwizofwYSztdUfV4mwkLOq%0AIcMQYdO0xMMUi9zcku1xGdAP+d6wF/l/SB/u1wx8ag==%0A&Version=2011-01-31&diskImageId=dummy
+ body:
+ string: ""
+ headers:
+ Accept:
+ - text/xml
+ User-Agent:
+ - OViSS-API-CLIENT
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Connection:
+ - close
+ Date:
+ - Mon, 18 Feb 2013 12:00:44 GMT
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml;charset=UTF-8
+ Set-Cookie:
+ - JSESSIONID=7E49EE8954F296DDBAAEEF109155D7C6; Path=/ovisspxy; Secure
+ body:
+ string: |
+ <?xml version="1.0" encoding="UTF-8"?>
+ <ListServerTypeResponse xmlns="http://apioviss.jp.fujitsu.com">
+ <responseMessage>Processing was completed.</responseMessage>
+ <responseStatus>SUCCESS</responseStatus>
+ <servertypes>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>4.0</cpuPerf>
+ <numOfCpu>1</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_144</id>
+ <memory>
+ <memorySize>7.5</memorySize>
+ </memory>
+ <name>advanced</name>
+ <price>0.4949</price>
+ <productId>AUS-VM-0001-0003</productId>
+ <productName>Advanced VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>1.0</cpuPerf>
+ <numOfCpu>1</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_140</id>
+ <memory>
+ <memorySize>1.7</memorySize>
+ </memory>
+ <name>economy</name>
+ <price>0.1237</price>
+ <productId>AUS-VM-0001-0001</productId>
+ <productName>Economy VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>4.0</cpuPerf>
+ <numOfCpu>2</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_146</id>
+ <memory>
+ <memorySize>15.0</memorySize>
+ </memory>
+ <name>high_performance</name>
+ <price>0.9898</price>
+ <productId>AUS-VM-0001-0004</productId>
+ <productName>High-Performance VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>2.0</cpuPerf>
+ <numOfCpu>1</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_142</id>
+ <memory>
+ <memorySize>3.4</memorySize>
+ </memory>
+ <name>standard</name>
+ <price>0.2474</price>
+ <productId>AUS-VM-0001-0002</productId>
+ <productName>Standard VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>4.0</cpuPerf>
+ <numOfCpu>4</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_146337</id>
+ <memory>
+ <memorySize>30.0</memorySize>
+ </memory>
+ <name>w_high</name>
+ <price>1.9796</price>
+ <productId>AUS-VM-0001-0011</productId>
+ <productName>Double-High Performance VM</productName>
+ </servertype>
+ </servertypes>
+ </ListServerTypeResponse>
+
+
+ http_version:
+ recorded_at: Mon, 18 Feb 2013 12:00:44 GMT
+recorded_with: VCR 2.4.0
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/fixtures/test_0006_must_include_at_least_four_profiles.yml
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/fixtures/test_0006_must_include_at_least_four_profiles.yml b/server/tests/drivers/fgcp/fixtures/test_0006_must_include_at_least_four_profiles.yml
new file mode 100644
index 0000000..d245041
--- /dev/null
+++ b/server/tests/drivers/fgcp/fixtures/test_0006_must_include_at_least_four_profiles.yml
@@ -0,0 +1,126 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: https://api.globalcloud.fujitsu.com.au/ovissapi/endpoint?AccessKeyId=QVVTIEVhc3Rlcm4gRGF5bGlnaHQgVGltZSYxMzYxMTg4ODQ2MDAwJjEuMCZT%0ASEExd2l0aFJTQQ==%0A&Action=ListServerType&Locale=en&Signature=Y7tplPpNJ+Ywx57yY0iTtNSbGsyCGHT/OQ0jbpow/T1TH9UqfsSqhQhptShM%0AnO4dDZDhfgjidofGCuKWzD080VqhUy2t/zuoVQiq9ByACbMLAagl0ljrTBGC%0AHxlrRJz/3lnpuBjDDRfoWXpNWUx4uap9fgdtTa1WouEusQDFyCn4JnB7uqxg%0AvBajPU6oxe1KR93paySLn07+qtxTWdZNNbaxh1oHtOuiT5Zne5udTB5Zl6S7%0AaXCDyZNBFiVUdI+HtlpeJgkcdUVLH3yi7cN3ZyLw01JUYWGpIzcESDi6k5id%0AoGaPjlvb2QWLy9a+QcpkUYesPI+PpSamleh28szuMQ==%0A&Version=2011-01-31&diskImageId=dummy
+ body:
+ string: ""
+ headers:
+ Accept:
+ - text/xml
+ User-Agent:
+ - OViSS-API-CLIENT
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Connection:
+ - close
+ Date:
+ - Mon, 18 Feb 2013 12:00:47 GMT
+ Transfer-Encoding:
+ - chunked
+ Content-Type:
+ - text/xml;charset=UTF-8
+ Set-Cookie:
+ - JSESSIONID=74FF50F12D915D378FEFCF71865EDC4B; Path=/ovisspxy; Secure
+ body:
+ string: |
+ <?xml version="1.0" encoding="UTF-8"?>
+ <ListServerTypeResponse xmlns="http://apioviss.jp.fujitsu.com">
+ <responseMessage>Processing was completed.</responseMessage>
+ <responseStatus>SUCCESS</responseStatus>
+ <servertypes>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>4.0</cpuPerf>
+ <numOfCpu>1</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_144</id>
+ <memory>
+ <memorySize>7.5</memorySize>
+ </memory>
+ <name>advanced</name>
+ <price>0.4949</price>
+ <productId>AUS-VM-0001-0003</productId>
+ <productName>Advanced VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>1.0</cpuPerf>
+ <numOfCpu>1</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_140</id>
+ <memory>
+ <memorySize>1.7</memorySize>
+ </memory>
+ <name>economy</name>
+ <price>0.1237</price>
+ <productId>AUS-VM-0001-0001</productId>
+ <productName>Economy VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>4.0</cpuPerf>
+ <numOfCpu>2</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_146</id>
+ <memory>
+ <memorySize>15.0</memorySize>
+ </memory>
+ <name>high_performance</name>
+ <price>0.9898</price>
+ <productId>AUS-VM-0001-0004</productId>
+ <productName>High-Performance VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>2.0</cpuPerf>
+ <numOfCpu>1</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_142</id>
+ <memory>
+ <memorySize>3.4</memorySize>
+ </memory>
+ <name>standard</name>
+ <price>0.2474</price>
+ <productId>AUS-VM-0001-0002</productId>
+ <productName>Standard VM</productName>
+ </servertype>
+ <servertype>
+ <chargeType>amount</chargeType>
+ <cpu>
+ <cpuArch>IA</cpuArch>
+ <cpuPerf>4.0</cpuPerf>
+ <numOfCpu>4</numOfCpu>
+ </cpu>
+ <expectedUsage>744</expectedUsage>
+ <id>islanda-cbrm_146337</id>
+ <memory>
+ <memorySize>30.0</memorySize>
+ </memory>
+ <name>w_high</name>
+ <price>1.9796</price>
+ <productId>AUS-VM-0001-0011</productId>
+ <productName>Double-High Performance VM</productName>
+ </servertype>
+ </servertypes>
+ </ListServerTypeResponse>
+
+
+ http_version:
+ recorded_at: Mon, 18 Feb 2013 12:00:47 GMT
+recorded_with: VCR 2.4.0
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/hardware_profiles_test.rb b/server/tests/drivers/fgcp/hardware_profiles_test.rb
index f65cd1f..96390d6 100644
--- a/server/tests/drivers/fgcp/hardware_profiles_test.rb
+++ b/server/tests/drivers/fgcp/hardware_profiles_test.rb
@@ -3,7 +3,7 @@ require 'require_relative' if RUBY_VERSION < '1.9'
require_relative 'common.rb'
-describe 'FGCP HardwareProfiles' do
+describe 'FgcpDriver HardwareProfiles' do
before do
@driver = Deltacloud::new(:fgcp, credentials)
@@ -14,9 +14,16 @@ describe 'FGCP HardwareProfiles' do
VCR.eject_cassette
end
+ it 'must throw error when wrong credentials' do
+ Proc.new do
+ @driver.backend.hardware_profiles(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+ end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
+ end
+
it 'must return list of hardware_profiles' do
- @driver.hardware_profiles.wont_be_empty
- @driver.hardware_profiles.first.must_be_kind_of Deltacloud::HardwareProfile
+ hardware_profiles = @driver.hardware_profiles
+ hardware_profiles.wont_be_empty
+ hardware_profiles.first.must_be_kind_of Deltacloud::HardwareProfile
end
it 'must allow to filter hardware_profiles' do
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/images_test.rb b/server/tests/drivers/fgcp/images_test.rb
index 24a852a..248d108 100644
--- a/server/tests/drivers/fgcp/images_test.rb
+++ b/server/tests/drivers/fgcp/images_test.rb
@@ -3,7 +3,7 @@ require 'require_relative' if RUBY_VERSION < '1.9'
require_relative 'common.rb'
-describe 'FGCP Images' do
+describe 'FgcpDriver Images' do
before do
@driver = Deltacloud::new(:fgcp, credentials)
@@ -14,6 +14,12 @@ describe 'FGCP Images' do
VCR.eject_cassette
end
+ it 'must throw error when wrong credentials' do
+ Proc.new do
+ @driver.backend.images(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+ end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
+ end
+
it 'must return list of images' do
imgs = @driver.images
imgs.wont_be_empty
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/provider_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/provider_test.rb b/server/tests/drivers/fgcp/provider_test.rb
new file mode 100644
index 0000000..d38d8a5
--- /dev/null
+++ b/server/tests/drivers/fgcp/provider_test.rb
@@ -0,0 +1,27 @@
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative 'common.rb'
+
+describe 'FgcpDriver Providers' do
+
+ before do
+ @driver = Deltacloud::new(:fgcp, credentials)
+ VCR.insert_cassette __name__
+ end
+
+ after do
+ VCR.eject_cassette
+ end
+
+ it 'must support listing of available providers' do
+ providers = @driver.providers
+ providers.wont_be_empty
+ providers.each { |p| p.must_be_kind_of Provider }
+ providers.each { |p| p.name.wont_be_empty }
+ providers.each { |p| p.url.wont_be_empty }
+ providers.each { |p| p.id.wont_be_empty }
+ providers.each { |p| ['fgcp-au', 'fgcp-sg', 'fgcp-uk', 'fgcp-us', 'fgcp-de', 'fgcp-jp-east', 'fgcp-jp-west'].must_include p.id }
+ end
+
+end
http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a9e21a0/server/tests/drivers/fgcp/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/fgcp/realms_test.rb b/server/tests/drivers/fgcp/realms_test.rb
new file mode 100644
index 0000000..7a4de63
--- /dev/null
+++ b/server/tests/drivers/fgcp/realms_test.rb
@@ -0,0 +1,53 @@
+require 'rubygems'
+require 'require_relative' if RUBY_VERSION < '1.9'
+
+require_relative 'common.rb'
+
+describe 'FgcpDriver Realms' do
+
+ before do
+ @driver = Deltacloud::new(:fgcp, credentials)
+ VCR.insert_cassette __name__
+ end
+
+ after do
+ VCR.eject_cassette
+ end
+
+ it 'must throw error when wrong credentials' do
+ Proc.new do
+ @driver.backend.realms(OpenStruct.new(:user => 'unknown', :password => 'wrong'))
+ end.must_raise Deltacloud::Exceptions::AuthenticationFailure, 'Authentication Failure'
+ end
+
+ it 'must return list of realms' do
+ realms = @driver.realms
+ realms.wont_be_empty
+ realms.first.must_be_kind_of Realm
+ # assume at least one vsys has been created, with at least 1 tier network
+ realms.size.wont_be :<, 2
+ end
+
+ it 'must allow to filter realms' do
+ realms = @driver.realms(:id => 'UZXC0GRT-ZG8ZJCJ07')
+ realms.wont_be_empty
+ realms.must_be_kind_of Array
+ realms.size.must_equal 1
+ realms.first.id.must_equal 'UZXC0GRT-ZG8ZJCJ07'
+ realms.first.name.must_equal 'Dies-DC-test'
+ realms.first.state.must_equal 'AVAILABLE'
+ @driver.realms(:id => 'unknown').must_be_empty
+ end
+
+ it 'must allow to retrieve single realm' do
+ realm = @driver.realm(:id => 'UZXC0GRT-ZG8ZJCJ07-N-DMZ')
+ realm.wont_be_nil
+ realm.must_be_kind_of Realm
+ realm.state.must_equal 'AVAILABLE'
+ realm.id.must_equal 'UZXC0GRT-ZG8ZJCJ07-N-DMZ'
+ realm.name.must_equal 'Dies-DC-test [DMZ]'
+ @driver.realm(:id => 'unknown').must_be_nil
+ end
+
+
+end