Commit 5a85389d authored by dgt's avatar dgt Committed by azul

WIP: pages still accessible after group was deleted

parent 3f0a987a
......@@ -248,7 +248,7 @@ announcement1:
## ASSETS
##
asset1:
asset_bee:
owner_name: animals
owner_id: 2
owner_type: Group
......@@ -272,7 +272,7 @@ asset1:
updated_at: "<%= updated.minutes.ago.to_s(:db) %>"
created_at: "<%= created.minutes.ago.to_s(:db) %>"
asset2:
asset_sunset:
owner_name: animals
owner_id: 2
owner_type: Group
......@@ -296,7 +296,7 @@ asset2:
updated_at: "<%= updated.minutes.ago.to_s(:db) %>"
created_at: "<%= created.minutes.ago.to_s(:db) %>"
asset3:
asset_crabgrass:
owner_name: animals
owner_id: 2
owner_type: Group
......
......@@ -18,4 +18,99 @@ class GroupDestructionTest < IntegrationTest
click_on 'Groups'
assert_no_content 'animals'
end
def test_visit_asset_page_owned_by_group_after_group_destruction
@user = users(:blue)
login
visit '/animals'
click_on 'Settings'
click_on 'Structure'
click_on 'Destroy animals'
logout
@user = users(:penguin)
login
visit '/me'
assert_content 'sunset'
click_on 'Show Request'
click_on 'Approve'
visit '/me'
assert_no_content 'sunset'
visit pages(:asset_sunset).uri
assert_not_found
end
def test_visit_wiki_page_owned_by_group_after_group_destruction
@user = users(:blue)
login
visit '/rainbow'
click_on 'Settings'
click_on 'Structure'
click_on 'Destroy rainbow'
logout
@user = users(:yellow)
login
visit '/me'
assert_content 'page owned by rainbow'
click_on 'Show Request'
click_on 'Approve'
visit '/me'
assert_no_content 'page owned by rainbow'
visit pages(:rainbow_page).uri
assert_not_found
end
def test_visit_wiki_page_owned_by_group
@user = users(:blue)
login
visit pages(:rainbow_page).uri+'+'+pages(:rainbow_page).id.to_s
assert_equal 200, status_code
end
def test_visit_asset_page_owned_by_group_with_user_participation_after_group_destruction
@user = users(:blue)
pages(:asset_sunset).add(users(:penguin), access: :admin)
pages(:asset_sunset).save!
assert pages(:asset_sunset).owner == groups(:animals)
login
visit '/animals'
click_on 'Settings'
click_on 'Structure'
click_on 'Destroy animals'
logout
@user = users(:penguin)
login
visit '/me'
assert_content 'sunset'
click_on 'Show Request'
click_on 'Approve'
visit '/me'
#assert_no_content 'sunset' # hidden because of https://0xacab.org/riseuplabs/crabgrass/merge_requests/139/diffs
visit pages(:asset_sunset).uri
assert_not_found
end
def test_visit_wiki_page_owned_by_group_with_user_participation_after_group_destruction
@user = users(:red)
pages(:rainbow_page).add(users(:yellow), access: :admin)
pages(:rainbow_page).save!
assert pages(:rainbow_page).owner == groups(:rainbow)
login
visit '/rainbow'
click_on 'Settings'
click_on 'Structure'
click_on 'Destroy rainbow'
logout
@user = users(:yellow)
login
visit '/me'
assert_content 'page owned by rainbow'
click_on 'Show Request'
click_on 'Approve'
visit '/me'
#assert_no_content 'sunset' # hidden because of https://0xacab.org/riseuplabs/crabgrass/merge_requests/139/diffs
#visit pages(:rainbow_page).uri # TEST will pass if we do this
#before (migth be related to caching)
visit pages(:rainbow_page).uri+'+'+pages(:rainbow_page).id.to_s
assert_not_found
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment