new ui / backend, cleaned up, and included tests --- src/app/controllers/portal_pool_controller.rb | 4 +++ src/app/views/portal_pool/accounts.html.erb | 21 ++++++++++++++++++++ .../controllers/portal_pool_controller_spec.rb | 19 ++++++++++++++++++ src/spec/factories/portal_pool.rb | 8 +++++++ 4 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 src/app/views/portal_pool/accounts.html.erb create mode 100644 src/spec/controllers/portal_pool_controller_spec.rb create mode 100644 src/spec/factories/portal_pool.rb
diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb index 24e530d..0b6ea6e 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -33,6 +33,10 @@ class PortalPoolController < ApplicationController @instances = @pool.instances end
+ def accounts + @pool = PortalPool.find(params[:id]) + end + def new @portal_pool = PortalPool.new @account = CloudAccount.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> + <%@pool.cloud_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 new file mode 100644 index 0000000..6b3a09c --- /dev/null +++ b/src/spec/controllers/portal_pool_controller_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +describe PortalPoolController do + + before(:each) do + @pool = Factory :tpool + @tuser = Factory :tuser + activate_authlogic + end + + it "should get cloud accounts" do + UserSession.create(@tuser) + 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/portal_pool.rb b/src/spec/factories/portal_pool.rb new file mode 100644 index 0000000..0b20647 --- /dev/null +++ b/src/spec/factories/portal_pool.rb @@ -0,0 +1,8 @@ +Factory.define :portal_pool do |p| + p.name 'mypool' + p.owner { |owner| owner.association(:user, :login => 'pool_owner', :email => 'pool_owner@example.com') } +end + +Factory.define :tpool, :parent => :portal_pool do |p| + p.name 'tpool' +end
Mo, I think this one needs to be rebased, trying to apply against new branch off of next, I get:
Applying: UI to view the list of provider accounts in a pool (revision 1) error: patch failed: src/app/controllers/portal_pool_controller.rb:33 error: src/app/controllers/portal_pool_controller.rb: patch does not apply error: src/spec/controllers/portal_pool_controller_spec.rb: already exists in index error: src/spec/factories/portal_pool.rb: already exists in index
On Tue, Mar 9, 2010 at 12:51 PM, Mohammed Morsi mmorsi@redhat.com wrote:
new ui / backend, cleaned up, and included tests
src/app/controllers/portal_pool_controller.rb | 4 +++ src/app/views/portal_pool/accounts.html.erb | 21 ++++++++++++++++++++ .../controllers/portal_pool_controller_spec.rb | 19 ++++++++++++++++++ src/spec/factories/portal_pool.rb | 8 +++++++ 4 files changed, 52 insertions(+), 0 deletions(-) create mode 100644 src/app/views/portal_pool/accounts.html.erb create mode 100644 src/spec/controllers/portal_pool_controller_spec.rb create mode 100644 src/spec/factories/portal_pool.rb
diff --git a/src/app/controllers/portal_pool_controller.rb b/src/app/controllers/portal_pool_controller.rb index 24e530d..0b6ea6e 100644 --- a/src/app/controllers/portal_pool_controller.rb +++ b/src/app/controllers/portal_pool_controller.rb @@ -33,6 +33,10 @@ class PortalPoolController < ApplicationController @instances = @pool.instances end
- def accounts
- @pool = PortalPool.find(params[:id])
- end
- def new @portal_pool = PortalPool.new @account = CloudAccount.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>
- <%@pool.cloud_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 new file mode 100644 index 0000000..6b3a09c --- /dev/null +++ b/src/spec/controllers/portal_pool_controller_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper'
+describe PortalPoolController do
- before(:each) do
- @pool = Factory :tpool
- @tuser = Factory :tuser
- activate_authlogic
- end
- it "should get cloud accounts" do
UserSession.create(@tuser)
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/portal_pool.rb b/src/spec/factories/portal_pool.rb new file mode 100644 index 0000000..0b20647 --- /dev/null +++ b/src/spec/factories/portal_pool.rb @@ -0,0 +1,8 @@ +Factory.define :portal_pool do |p|
- p.name 'mypool'
- p.owner { |owner| owner.association(:user, :login => 'pool_owner',
:email => 'pool_owner@example.com') } +end
+Factory.define :tpool, :parent => :portal_pool do |p|
- p.name 'tpool'
+end
1.6.2.5
deltacloud-devel mailing list deltacloud-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/deltacloud-devel
deltacloud-devel@lists.fedorahosted.org