new ui / backend / tests
---
src/app/controllers/portal_pool_controller.rb | 5 ++++
src/app/views/portal_pool/accounts.html.erb | 21 ++++++++++++++++++++
.../controllers/portal_pool_controller_spec.rb | 8 +++++++
src/spec/factories/privilege.rb | 4 +++
src/spec/factories/role.rb | 3 +-
5 files changed, 40 insertions(+), 1 deletions(-)
create mode 100644 src/app/views/portal_pool/accounts.html.erb
diff --git a/src/app/controllers/portal_pool_controller.rb
b/src/app/controllers/portal_pool_controller.rb
index d17eaac..2f83e1e 100644
--- a/src/app/controllers/portal_pool_controller.rb
+++ b/src/app/controllers/portal_pool_controller.rb
@@ -33,6 +33,11 @@ class PortalPoolController < ApplicationController
@instances = @pool.instances
end
+ def accounts
+ @pool = PortalPool.find(params[:id])
+ require_privilege(Privilege::INSTANCE_VIEW,@pool)
+ end
+
def new
require_privilege(Privilege::POOL_MODIFY)
@portal_pool = PortalPool.new
diff --git a/src/app/views/portal_pool/accounts.html.erb
b/src/app/views/portal_pool/accounts.html.erb
new file mode 100644
index 0000000..b6042d6
--- /dev/null
+++ b/src/app/views/portal_pool/accounts.html.erb
@@ -0,0 +1,21 @@
+<% if @pool.cloud_accounts.size == 0 %>
+<h1>There are no accounts to display</h1>
+<% else %>
+ <table>
+ <thead>
+ <tr>
+ <th scope="col">Provider</th>
+ <th scope="col">Username</th>
+ </tr>
+ </thead>
+ <tbody>
+ <%[email protected]_accounts.each {|account| %>
+ <tr>
+ <td><%= account.provider.name %></td>
+ <td><%= account.username %></td>
+ </tr>
+ <% } %>
+ </tbody>
+ </table>
+<% end %>
+<%= link_to "Add an account", {:controller => "portal_pool", :action =>
"new_account", :pool => @pool.id}, :class => "actionlink" %>
diff --git a/src/spec/controllers/portal_pool_controller_spec.rb
b/src/spec/controllers/portal_pool_controller_spec.rb
index d409c3a..35727d9 100644
--- a/src/spec/controllers/portal_pool_controller_spec.rb
+++ b/src/spec/controllers/portal_pool_controller_spec.rb
@@ -30,5 +30,13 @@ describe PortalPoolController do
response.should redirect_to('http://test.host/portal_pool/show/1')
end
+ it "should get cloud accounts" do
+ @pool = Factory :tpool
+ UserSession.create(@admin)
+ get :accounts, :id => @pool.id
+ response.should be_success
+ response.should render_template("accounts")
+ @pool.should_not == nil
+ end
end
diff --git a/src/spec/factories/privilege.rb b/src/spec/factories/privilege.rb
index 46bdeb4..cdc3fc7 100644
--- a/src/spec/factories/privilege.rb
+++ b/src/spec/factories/privilege.rb
@@ -12,3 +12,7 @@ end
Factory.define :view_provider_priv, :parent => :privilege do |p|
p.name 'provider_view'
end
+
+Factory.define :view_pool_instance_priv, :parent => :privilege do |p|
+ p.name 'instance_view'
+end
diff --git a/src/spec/factories/role.rb b/src/spec/factories/role.rb
index b126721..aef1f3e 100644
--- a/src/spec/factories/role.rb
+++ b/src/spec/factories/role.rb
@@ -8,7 +8,8 @@ Factory.define :admin_role, :parent => :role do |r|
r.scope 'BasePortalObject'
r.privileges { |p| [ p.association(:modify_pool_priv),
p.association(:modify_provider_priv),
- p.association(:view_provider_priv) ] }
+ p.association(:view_provider_priv),
+ p.association(:view_pool_instance_priv)] }
end
Factory.define :instance_creator, :parent => :role do |r|
--
1.6.2.5
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel