On 03/23/2011 10:08 AM, Jiří Tomášek wrote:
ACK, although, there are some trailing whitespaces in
/src/features/pool.feature and one new blank line at EOF in
/src/features/step_definitions/pool_steps.rb
Although one comment that we should
probably resolve first.
>
https://bugzilla.redhat.com/show_bug.cgi?id=684088
> ---
> src/app/controllers/resources/pools_controller.rb | 2 +-
> src/features/pool.feature | 8 ++++++++
> src/features/step_definitions/pool_steps.rb | 7 +++++++
> 3 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/src/app/controllers/resources/pools_controller.rb
b/src/app/controllers/resources/pools_controller.rb
> index 3a927f1..40d5edb 100644
> --- a/src/app/controllers/resources/pools_controller.rb
> +++ b/src/app/controllers/resources/pools_controller.rb
> @@ -77,7 +77,7 @@ class Resources::PoolsController< ApplicationController
> # FIXME: remove this check when pools can be assigned to new users
> # default_pool cannot be deleted because metadata object has it tied
> # to id of 1 and deleting it prevents new users from being created
> - if pool.name == "default_pool"
> + if pool.name == "default_pool" || pool.id == 1
Lets not rely
on IDs, actually, since we can't necessarily guarantee it
will be one (and, in theory a different pool can be made default,
although there's no UI for this at the moment. You can get the ID of the
current default pool with:
if pool.id == MetadataObject.lookup("self_service_default_pool").id
And then we don't care about name (for one thing the name can still be
changed...)
Scott
> flash[:notice] = "The default pool cannot be
deleted"
> else
> pool.destroy if check_privilege(Privilege::MODIFY, pool)
> diff --git a/src/features/pool.feature b/src/features/pool.feature
> index 864357b..9f46a4e 100644
> --- a/src/features/pool.feature
> +++ b/src/features/pool.feature
> @@ -86,3 +86,11 @@ Feature: Manage Pools
> And I press "Destroy"
> Then I should see "The default pool cannot be deleted"
> And I should see "default_pool"
> +
> + Scenario: Cannot delete default_pool by renaming it
> + Given I renamed default_pool to pool_default
> + Given I am on the pools page
> + When I check "pool_default" pool
> + And I press "Destroy"
> + Then I should see "The default pool cannot be deleted"
> + And I should see "pool_default"
> diff --git a/src/features/step_definitions/pool_steps.rb
b/src/features/step_definitions/pool_steps.rb
> index 689bd47..a495490 100644
> --- a/src/features/step_definitions/pool_steps.rb
> +++ b/src/features/step_definitions/pool_steps.rb
> @@ -59,3 +59,10 @@ Given /^the "([^\"]*)" Pool has a quota with
following capacities:$/ do |name,ta
> @pool.quota_id = @quota.id
> @pool.save
> end
> +
> +Given /^I renamed default_pool to pool_default$/ do
> + p = Pool.find_by_name("default_pool")
> + p.name = "pool_default"
> + p.save
> +end
> +
_______________________________________________
aeolus-devel mailing list
aeolus-devel(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/aeolus-devel