From: Tomas Sedovic <[email protected]>
---
src/features/provider_account.feature | 70 ++++++++++++++++++++
.../step_definitions/provider_account_steps.rb | 26 +++++++
src/features/support/paths.rb | 3 +
src/features/upload_files/private.key | 1 +
src/features/upload_files/public.key | 1 +
5 files changed, 101 insertions(+), 0 deletions(-)
create mode 100644 src/features/provider_account.feature
create mode 100644 src/features/step_definitions/provider_account_steps.rb
create mode 100644 src/features/upload_files/private.key
create mode 100644 src/features/upload_files/public.key
diff --git a/src/features/provider_account.feature
b/src/features/provider_account.feature
new file mode 100644
index 0000000..9a73bb5
--- /dev/null
+++ b/src/features/provider_account.feature
@@ -0,0 +1,70 @@
+Feature: Manage Provider Accounts
+ In order to manage my cloud infrastructure
+ As a user
+ I want to manage provider accounts
+
+ Background:
+ Given I am an authorised user
+ And I am logged in
+ And I am using new UI
+
+ Scenario: List provider accounts
+ Given I am on the homepage
+ And there is a provider named "testprovider"
+ When I go to the admin provider accounts page
+ Then I should see "New Account"
+ And there should be no provider accounts
+
+ Scenario: Create a new Provider Account
+ Given there is a provider named "testprovider"
+ And there are no provider accounts
+ And I am on the admin provider accounts page
+ When I follow "New Account"
+ Then I should be on the new admin provider account page
+ And I should see "New Account"
+ When I select "testprovider" from "provider_id"
+ And I fill in "cloud_account[label]" with "testaccount"
+ And I fill in "cloud_account[username]" with "mockuser"
+ And I fill in "cloud_account[password]" with "mockpassword"
+ And I fill in "quota[maximum_running_instances]" with "13"
+ And I fill in "cloud_account[account_number]" with "222222"
+ And I attach the "private.key" file to "cloud_account[x509_cert_priv_file]"
+ And I attach the "public.key" file to "cloud_account[x509_cert_pub_file]"
+ And I press "Add"
+ Then I should be on testaccount's provider account page
+ And I should see "Provider account added"
+ And I should have a provider account named "testaccount"
+ And I should see "Properties for testaccount"
+ And I should see "Running instances quota: 13"
+ And I should see "Account ID: 222222"
+
+ Scenario: Test Provider Account Connection Successful
+ Given there is a provider named "testprovider"
+ And there are no provider accounts
+ And I am on the admin provider accounts page
+ When I follow "New Account"
+ Then I should be on the new admin provider account page
+ When I fill in "cloud_account[username]" with "mockuser"
+ And I fill in "cloud_account[password]" with "mockpassword"
+ And I press "Test Account"
+ Then I should see "Test Connection Success"
+
+ Scenario: Test Provider Account Connection Failure
+ Given there is a provider named "testprovider"
+ And there are no provider accounts
+ And I am on the admin provider accounts page
+ When I follow "New Account"
+ Then I should be on the new admin provider account page
+ When I fill in "cloud_account[username]" with "mockuser"
+ And I fill in "cloud_account[password]" with "wrong password"
+ And I press "Test Account"
+ Then I should see "Test Connection Failed"
+
+ Scenario: Delete a provider account
+ Given there is a provider named "testprovider"
+ And there is a provider account named "testaccount"
+ And I am on the admin provider accounts page
+ When I check the "testaccount" account
+ And I press "Delete"
+ Then I should be on the admin provider accounts page
+ And there should be no provider accounts
diff --git a/src/features/step_definitions/provider_account_steps.rb
b/src/features/step_definitions/provider_account_steps.rb
new file mode 100644
index 0000000..bf9991c
--- /dev/null
+++ b/src/features/step_definitions/provider_account_steps.rb
@@ -0,0 +1,26 @@
+Then /^there should be no provider accounts$/ do
+ CloudAccount.all.should be_empty
+end
+
+Given /^there are no provider accounts$/ do
+ CloudAccount.all.should be_empty
+end
+
+When /^I attach the "([^"\s]+)" file to "([^"\s]+)"$/ do |file, field|
+ path = File.join(RAILS_ROOT, 'features', 'upload_files', file)
+ attach_file(field, path, 'text/plain')
+end
+
+Then /^I should have a provider account named "([^"]*)"$/ do |label|
+ CloudAccount.find_by_label(label).should_not be_nil
+end
+
+Given /^there is a provider account named "([^"]*)"$/ do |label|
+ @provider = Provider.find_by_name('testprovider')
+ @cloud_account = Factory(:mock_cloud_account, :provider => @provider, :label
=> label)
+end
+
+When /^I check the "([^"]*)" account$/ do |label|
+ account = CloudAccount.find_by_label(label)
+ check("account_checkbox_#{account.id}")
+end
diff --git a/src/features/support/paths.rb b/src/features/support/paths.rb
index c81fd20..fba0e99 100644
--- a/src/features/support/paths.rb
+++ b/src/features/support/paths.rb
@@ -98,6 +98,9 @@ module NavigationHelpers
when /the hardware profiles page/
url_for admin_hardware_profiles_path
+ when /^(.*)'s provider account page$/
+ admin_provider_account_path(CloudAccount.find_by_label($1))
+
# Add more mappings here.
# Here is an example that pulls values out of the Regexp:
#
diff --git a/src/features/upload_files/private.key
b/src/features/upload_files/private.key
new file mode 100644
index 0000000..924f3fc
--- /dev/null
+++ b/src/features/upload_files/private.key
@@ -0,0 +1 @@
+private key
diff --git a/src/features/upload_files/public.key
b/src/features/upload_files/public.key
new file mode 100644
index 0000000..717a241
--- /dev/null
+++ b/src/features/upload_files/public.key
@@ -0,0 +1 @@
+public key
--
1.7.3.4
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel