---
src/features/portal_pool.feature | 79 ++++++++++++++++++++
src/features/step_definitions/portal_pool_steps.rb | 42 ++++++++++
src/features/support/env.rb | 8 ++
src/features/support/paths.rb | 15 +++-
src/spec/factories/hardware_profile.rb | 7 ++
src/spec/factories/provider.rb | 4 +-
src/spec/factories/realm.rb | 1 +
7 files changed, 153 insertions(+), 3 deletions(-)
create mode 100644 src/features/portal_pool.feature
create mode 100644 src/features/step_definitions/portal_pool_steps.rb
diff --git a/src/features/portal_pool.feature b/src/features/portal_pool.feature
new file mode 100644
index 0000000..2011fab
--- /dev/null
+++ b/src/features/portal_pool.feature
@@ -0,0 +1,79 @@
+Feature: Manage Portal Pools
+ In order to manage my cloud infrastructure
+ As a user
+ I want to manage my portal pools
+
+ Scenario: Create a new Pool
+ Given I am on the homepage
+ And I am an authorised user
+ And I am logged in
+ And there is not a portal pool named "mockpool"
+ When I follow "Add a pool"
+ Then I should be on the new portal pool page
+ And I should see "Create a new Pool"
+ When I fill in "portal_pool_name" with "mockpool"
+ And I press "Save"
+ Then I should be on the show portal pool page
+ And I should see "Pool added"
+ And I should see "mockpool"
+ And I should have a portal pool named "mockpool"
+
+ @focus
+ Scenario: View Portal Pool's Hardware Profiles
+ Given I am an authorised user
+ And I own a portal pool named "mockpool"
+ And the Portal Pool has the following Hardware Profiles:
+ | name | memory | storage | architecture |
+ | m1-small | 1.7 | 160.0 | i386 |
+ | m1-large | 7.5 | 850.0 | x86_64 |
+ | m1-xlarge | 15.0 | 1690.0 | x86_64 |
+ And I am logged in
+ And I am on the homepage
+ When I follow "mockpool"
+ Then I should be on the show portal pool page
+ When I follow "Hardware Profiles"
+ Then I should see "m1-small"
+ And I should see "m1-large"
+ And I should see "m1-xlarge"
+ And I should see "1.7"
+ And I should see "7.5"
+ And I should see "15.0"
+ And I should see "160.0"
+ And I should see "850.0"
+ And I should see "1690.0"
+ And I should see "i386"
+ And I should see "x86_64"
+ And I should see "x86_64"
+
+ @focus
+ Scenario: View Portal Pool's Realms
+ Given I am an authorised user
+ And I own a portal pool named "mockpool"
+ And the Portal Pool has the following Realms named "Europe, United
States"
+ And I am logged in
+ And I am on the account page
+ When I follow "mockpool"
+ Then I should be on the show portal pool page
+ When I follow "Realms"
+ Then I should see "Europe"
+ And I should see "United States"
+
+ Scenario: View Portal Pool's Images
+ Given I am an authorised user
+ And I am logged in
+ And I own a portal pool named "mockpool"
+ And the Portal Pool has the following Images:
+ | name | architecture |
+ | Fedora 10 | x86_64 |
+ | Fedora 10 | i386 |
+ | JBoss | i386 |
+ And I am on the account page
+ When I follow "mockpool"
+ Then I should be on the show portal pool page
+ When I follow "View Images"
+ Then I should see "Fedora 10"
+ And I should see "x86_64"
+ And I should see "Fedora 10"
+ And I should see "i386"
+ And I should see "JBoss"
+ And I should see "i386"
\ No newline at end of file
diff --git a/src/features/step_definitions/portal_pool_steps.rb
b/src/features/step_definitions/portal_pool_steps.rb
new file mode 100644
index 0000000..4e20a7a
--- /dev/null
+++ b/src/features/step_definitions/portal_pool_steps.rb
@@ -0,0 +1,42 @@
+Given /^I am an authorised user$/ do
+ @admin_permission = Factory :admin_permission
+ @user = @admin_permission.user
+end
+
+Given /^I own a portal pool named "([^\"]*)"$/ do |name|
+ @portal_pool = Factory(:portal_pool, :name => name)
+ @user.owned_pools << @portal_pool
+end
+
+Given /^the Portal Pool has the following Hardware Profiles:$/ do |table|
+ table.hashes.each do |hash|
+ @portal_pool.hardware_profiles << Factory(:hardware_profile_auto, hash)
+ end
+end
+
+Given /^the Portal Pool has the following Realms named "([^\"]*)"$/ do |names|
+ @cloud_account = Factory :cloud_account
+ @provider = @cloud_account.provider
+
+ names.split(", ").each do |name|
+ @portal_pool.realms << Factory(:realm, :name => name, :provider =>
@provider)
+ end
+ @portal_pool.cloud_accounts << @cloud_account
+
+end
+
+Given /^the Portal Pool has the following Images:$/ do |table|
+ table.hashes.each do |hash|
+ hash["portal_pool"] = @portal_pool
+ @portal_pool.images << Factory(:image, hash)
+ end
+end
+
+Given /^there is not a portal pool named "([^\"]*)"$/ do |name|
+ PortalPool.find_by_name(name).should be_nil
+end
+
+Then /^I should have a portal pool named "([^\"]*)"$/ do |name|
+ PortalPool.find_by_name(name).should_not be_nil
+ PortalPool.find_by_name(name).permissions.size.should == 1
+end
\ No newline at end of file
diff --git a/src/features/support/env.rb b/src/features/support/env.rb
index 341854f..2d6e9a1 100644
--- a/src/features/support/env.rb
+++ b/src/features/support/env.rb
@@ -21,6 +21,14 @@ Webrat.configure do |config|
config.open_error_files = false # Set to true if you want error pages to pop
up in the browser
end
+Provider.class_eval do
+ alias_method :original_validate, :validate
+ def validate
+ if !nil_or_empty(url)
+ # errors.add("url", "must be a valid provider url") unless
valid_framework?
+ end
+ end
+end
# If you set this to false, any error raised from within your app will bubble
# up to your step definition and out to cucumber unless you catch it somewhere
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index 7c16ade..5fc4127 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -22,13 +22,24 @@ module NavigationHelpers
when /the account page/
account_path
-
+
when /the login error page/
user_session_path
when /the new provider page/
new_provider_path
-
+
+ when /the new portal pool page/
+ new_portal_pool_path
+
+ when /the show portal pool page/
+ portal_pool_path
+
+ when /the portal pool realms page/
+ portal_pool_realms_path
+
+ when /the portal pool hardware profiles page/
+ hardware_profiles_portal_pool_path
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#
diff --git a/src/spec/factories/hardware_profile.rb
b/src/spec/factories/hardware_profile.rb
index 752adac..43f63f3 100644
--- a/src/spec/factories/hardware_profile.rb
+++ b/src/spec/factories/hardware_profile.rb
@@ -22,3 +22,10 @@ Factory.define :pool_hwp1, :parent => :hardware_profile do
|p|
p.external_key 'pool_hwp1_key'
p.architecture 'x86_64'
end
+
+Factory.define :hardware_profile_auto, :parent => :hardware_profile do |p|
+ p.external_key { |hp| hp.name + "_key" }
+ p.storage 160
+ p.memory 1024
+ p.architecture "i386"
+end
\ No newline at end of file
diff --git a/src/spec/factories/provider.rb b/src/spec/factories/provider.rb
index 90976ff..1d3e3b7 100644
--- a/src/spec/factories/provider.rb
+++ b/src/spec/factories/provider.rb
@@ -1,5 +1,7 @@
Factory.define :provider do |p|
p.sequence(:name) { |n| "provider#{n}" }
+ p.cloud_type 'mock'
+ p.url { |p| "http://www." + p.name + ".com/api" }
end
Factory.define :mock_provider, :parent => :provider do |p|
@@ -14,4 +16,4 @@ Factory.define :mock_provider2, :parent => :provider do |p|
p.cloud_type 'mock'
p.url 'http://localhost:3001/api'
p.after_create { |p| p.realms << Factory(:realm3, :provider => p) }
-end
+end
\ No newline at end of file
diff --git a/src/spec/factories/realm.rb b/src/spec/factories/realm.rb
index 93a6516..f4df03b 100644
--- a/src/spec/factories/realm.rb
+++ b/src/spec/factories/realm.rb
@@ -1,6 +1,7 @@
Factory.define :realm do |r|
r.sequence(:name) { |n| "realm#{n}" }
r.sequence(:external_key) { |n| "key#{n}" }
+ r.association(:provider)
end
Factory.define :realm1, :parent => :realm do |r|
--
1.6.6.1
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel