X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3598c3003a7987cca5c0536ba8206ec40c1c3649..5cb7bacb7326d1aae1b5b323614d6b46d93d0e99:/services/api/test/unit/collection_test.rb diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb index 37ab1d3172..d8b8365efa 100644 --- a/services/api/test/unit/collection_test.rb +++ b/services/api/test/unit/collection_test.rb @@ -233,4 +233,24 @@ class CollectionTest < ActiveSupport::TestCase assert_equal 'value_1', c.properties['property_1'] end end + + test 'create, delete, recreate collection with same name and owner' do + act_as_user users(:active) do + # create collection with name + c = Collection.create(manifest_text: '', + name: "test collection name") + assert c.valid? + uuid = c.uuid + + # mark collection as expired + c.update_attribute 'expires_at', Time.new.strftime("%Y-%m-%d") + c = Collection.where(uuid: uuid) + assert_empty c, 'Should not be able to find expired collection' + + # recreate collection with the same name + c = Collection.create(manifest_text: '', + name: "test collection name") + assert c.valid? + end + end end