X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/ce9c2266d5267937d25562824df3ccf4d4d7fe7c..9624ed0931aac929f0d773dfee8b9e620b9352ad:/services/api/test/unit/user_test.rb diff --git a/services/api/test/unit/user_test.rb b/services/api/test/unit/user_test.rb index 98ce55b0b8..c410787a11 100644 --- a/services/api/test/unit/user_test.rb +++ b/services/api/test/unit/user_test.rb @@ -159,10 +159,10 @@ class UserTest < ActiveSupport::TestCase [false, 'active-notify@example.com', 'inactive-notify@example.com', 'auto_setup_repo@example.com', false, true, true], # existing repository name 'auto_setup_repo' [false, 'active-notify@example.com', 'inactive-notify@example.com', 'auto_setup_repo@example.com', false, false, true], # existing repository name 'auto_setup_repo', but we are not creating repo or login link - [false, 'active-notify@example.com', 'inactive-notify@example.com', 'xyz_can_login_to_vm@example.com', true, true, true], # existing vm login name - [true, 'active-notify@example.com', 'inactive-notify@example.com', 'xyz_can_login_to_vm@example.com', true, false, true], # existing vm login name - [false, 'active-notify@example.com', 'inactive-notify@example.com', 'xyz_can_login_to_vm@example.com', false, true, true], # existing vm login name - [false, 'active-notify@example.com', 'inactive-notify@example.com', 'xyz_can_login_to_vm@example.com', false, false, true], # existing vm login name, but we are not creating repo or login link + [false, 'active-notify@example.com', 'inactive-notify@example.com', 'auto_setup_vm_login@example.com', true, true, true], # existing vm login name + [true, 'active-notify@example.com', 'inactive-notify@example.com', 'auto_setup_vm_login@example.com', true, false, true], # existing vm login name + [false, 'active-notify@example.com', 'inactive-notify@example.com', 'auto_setup_vm_login@example.com', false, true, true], # existing vm login name + [false, 'active-notify@example.com', 'inactive-notify@example.com', 'auto_setup_vm_login@example.com', false, false, true], # existing vm login name, but we are not creating repo or login link [true, 'active-notify@example.com', 'inactive-notify@example.com', '*!*@example.com', true, false, false], # username is invalid format [false, 'active-notify@example.com', 'inactive-notify@example.com', '*!*@example.com', false, false, true], # since no repo and vm login, username is ok (not validated) @@ -500,6 +500,14 @@ class UserTest < ActiveSupport::TestCase verify_link_exists true, repo_uuids, user.uuid, 'permission', 'can_manage', nil, nil end + # if username is existing vm login name, make sure the username used to generate any repo is unique + if username == 'auto_setup_vm_login' + if repo_names.any? + assert repo_names.first.start_with? 'auto_setup_vm_login' + assert_not_nil /\d$/.match(repo_names.first) + end + end + # check vm uuid vm_uuid = Rails.configuration.auto_setup_new_users_with_vm_uuid if vm_uuid