From: Jan Provaznik <[email protected]>
---
src/app/views/resources/instances/_properties.haml | 2 +-
src/features/step_definitions/instance.rb | 11 ++++-------
src/features/support/custom.rb | 11 ++++++++---
src/spec/factories/instance_key.rb | 6 +++---
4 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/app/views/resources/instances/_properties.haml
b/src/app/views/resources/instances/_properties.haml
index 6f8120e..5283e20 100644
--- a/src/app/views/resources/instances/_properties.haml
+++ b/src/app/views/resources/instances/_properties.haml
@@ -41,7 +41,7 @@
%li
= label_tag :console_connection, 'Console Connection'
%span= 'via SSH'
- - unless @instance.instance_key_id.nil?
+ - if @instance.instance_key
%li
= label_tag :instance_key, 'SSH key'
%span= link_to("Download", key_resources_instance_path(@instance))
diff --git a/src/features/step_definitions/instance.rb
b/src/features/step_definitions/instance.rb
index f93d08c..412cd57 100644
--- a/src/features/step_definitions/instance.rb
+++ b/src/features/step_definitions/instance.rb
@@ -7,7 +7,7 @@ def pending_instance
end
Given /^a mock running instance exists$/ do
- mock_instance
+ mock_instance.instance_key = Factory :mock_instance_key, :instance_key_owner
=> mock_instance
end
Given /^a mock pending instance exists$/ do
@@ -15,18 +15,15 @@ Given /^a mock pending instance exists$/ do
end
Given /^I am viewing the mock instance detail$/ do
- visit url_for :action => 'show', :controller => 'instances',
- :id => mock_instance
+ visit resources_instance_url(mock_instance)
end
When /^I am viewing the pending instance detail$/ do
- visit url_for :action => 'show', :controller => 'instances',
- :id => pending_instance
+ visit resources_instance_url(pending_instance)
end
When /^I manually go to the key action for this instance$/ do
- visit url_for :action => 'key', :controller => 'instances',
- :id => pending_instance
+ visit key_resources_instance_url(pending_instance)
end
Given /^I see "([^"]*)"$/ do |text|
diff --git a/src/features/support/custom.rb b/src/features/support/custom.rb
index 6b0db10..12a3a45 100644
--- a/src/features/support/custom.rb
+++ b/src/features/support/custom.rb
@@ -28,14 +28,19 @@ Provider.class_eval do
end
CloudAccount.class_eval do
-
- alias :generate_cloud_account_key_original :generate_cloud_account_key
+
+ alias :generate_auth_key_original :generate_auth_key
def validate_credentials
true
end
- def generate_cloud_account_key
+ def generate_auth_key
+ key = OpenStruct.new(:pem => 'PEM')
+ def key.id
+ "mock_#{Time.now.to_i}_key_#{self.object_id}"
+ end
+ key
end
# def instance_key
diff --git a/src/spec/factories/instance_key.rb
b/src/spec/factories/instance_key.rb
index d5bc69a..f392de6 100644
--- a/src/spec/factories/instance_key.rb
+++ b/src/spec/factories/instance_key.rb
@@ -28,10 +28,10 @@
uH9ebPTGZc5cTpOEV9SupUez4cAedBGeHVDHy06sATrgIwKBgQCdqFhrse+uhRacK1LAymvBsou5
end
Factory.define :ec2_instance_key1, :parent => :instance_key do |p|
- p.cloud_account { |p| p.association(:ec2_cloud_account) }
+ p.instance_key_owner { |p| p.association(:ec2_instance) }
p.name "1_user"
end
Factory.define :mock_instance_key, :parent => :instance_key do |m|
- m.cloud_account { |c| c.association(:mock_cloud_account) }
-end
\ No newline at end of file
+ m.instance_key_owner { |c| c.association(:instance) }
+end
--
1.7.3.4
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel