manifest_text: ". 73feffa4b7f6bb68e44cf984c85f6e88+3 0:3:baz\n"
name: collection_to_move_around
+# Note: collections(:expired_collection) fixture finder won't work
+# because it is not in default scope
expired_collection:
uuid: zzzzz-4zz18-mto52zx1s7sn3ih
portable_data_hash: 0b21a217243bfce5617fb9224b95bcb9+49
manifest_text: ". 37b51d194a7513e45b56f6524f2d51f2+3 0:3:expired\n"
name: trashed_on_next_sweep
+# Note: collections(:deleted_on_next_sweep) fixture finder won't work
+# because it is not in default scope
deleted_on_next_sweep:
uuid: zzzzz-4zz18-3u1p5umicfpqszp
portable_data_hash: 0b21a217243bfce5617fb9224b95bcb9+49
end
test 'get trashed collection with include_trash' do
- uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih'
+ uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
authorize_with :active
get :show, {
id: uuid,
end
test 'get trashed collection without include_trash' do
- uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih'
+ uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
authorize_with :active
get :show, {
id: uuid,
end
test 'delete long-trashed collection immediately using http DELETE verb' do
- uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih'
+ uuid = 'zzzzz-4zz18-mto52zx1s7sn3ih' # expired_collection
authorize_with :active
delete :destroy, {
id: uuid,
assert_operator c.delete_at, :<, db_current_time
end
- ['zzzzz-4zz18-mto52zx1s7sn3ih',
- 'zzzzz-4zz18-5qa38qghh1j3nvv',
- ].each do |uuid|
- test "trash collection #{uuid} via trash action with grace period" do
+ ['zzzzz-4zz18-mto52zx1s7sn3ih', # expired_collection
+ :empty_collection_name_in_active_user_home_project,
+ ].each do |fixture|
+ test "trash collection #{fixture} via trash action with grace period" do
+ if fixture.is_a? String
+ uuid = fixture
+ else
+ uuid = collections(fixture).uuid
+ end
authorize_with :active
time_before_trashing = db_current_time
post :trash, {
end
test "move to trash in SweepTrashedCollections" do
- uuid = 'zzzzz-4zz18-4guozfh77ewd2f0'
- c = Collection.where('uuid=? and is_trashed=false', uuid).first
- assert c
+ c = collections(:trashed_on_next_sweep)
+ refute_empty Collection.where('uuid=? and is_trashed=false', c.uuid)
assert_raises(ActiveRecord::RecordNotUnique) do
act_as_user users(:active) do
Collection.create!(owner_uuid: c.owner_uuid,
end
end
SweepTrashedCollections.sweep_now
- c = Collection.unscoped.find_by_uuid(uuid)
- assert_equal true, c.is_trashed
+ c = Collection.unscoped.where('uuid=? and is_trashed=true', c.uuid).first
+ assert c
act_as_user users(:active) do
assert Collection.create!(owner_uuid: c.owner_uuid,
name: c.name)
end
test "delete in SweepTrashedCollections" do
- uuid = 'zzzzz-4zz18-3u1p5umicfpqszp'
+ uuid = 'zzzzz-4zz18-3u1p5umicfpqszp' # deleted_on_next_sweep
assert_not_empty Collection.unscoped.where(uuid: uuid)
SweepTrashedCollections.sweep_now
assert_empty Collection.unscoped.where(uuid: uuid)