X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3794eb59917f309eb69dbfebbe09c8b594e712cc..282562ff358c549980a48ccca41944039f86483a:/services/api/test/unit/link_test.rb diff --git a/services/api/test/unit/link_test.rb b/services/api/test/unit/link_test.rb index 626f470c02..b9806486ad 100644 --- a/services/api/test/unit/link_test.rb +++ b/services/api/test/unit/link_test.rb @@ -109,7 +109,7 @@ class LinkTest < ActiveSupport::TestCase test "updating permission causes any conflicting links to be deleted" do link1, link2 = create_overlapping_permissions(['can_read', 'can_manage']) - Link.find_by_uuid(link2).update_attributes!(name: 'can_write') + Link.find_by_uuid(link2).update!(name: 'can_write') assert_empty Link.where(uuid: link1) end @@ -118,4 +118,17 @@ class LinkTest < ActiveSupport::TestCase Link.find_by_uuid(wlink).destroy assert_empty Link.where(uuid: rlink) end + + test "updating login permission causes any conflicting links to be deleted" do + link1, link2 = create_overlapping_permissions(['can_login', 'can_login'], {properties: {username: 'foo1'}}) + Link.find_by_uuid(link1).update!(properties: {'username' => 'foo2'}) + Link.find_by_uuid(link2).update!(properties: {'username' => 'foo2'}) + assert_empty Link.where(uuid: link1) + end + + test "deleting login permission causes any conflicting links to be deleted" do + link1, link2 = create_overlapping_permissions(['can_login', 'can_login'], {properties: {username: 'foo1'}}) + Link.find_by_uuid(link1).destroy + assert_empty Link.where(uuid: link2) + end end