3 class Arvados::V1::UsersControllerTest < ActionController::TestCase
4 include CurrentApiClient
7 @all_links_at_start = Link.all
8 @vm_uuid = virtual_machines(:testvm).uuid
11 test "activate a user after signing UA" do
12 authorize_with :inactive_but_signed_user_agreement
14 assert_response :success
15 me = JSON.parse(@response.body)
16 post :activate, uuid: me['uuid']
17 assert_response :success
18 assert_not_nil assigns(:object)
19 me = JSON.parse(@response.body)
20 assert_equal true, me['is_active']
23 test "refuse to activate a user before signing UA" do
24 authorize_with :inactive
26 assert_response :success
27 me = JSON.parse(@response.body)
28 post :activate, uuid: me['uuid']
31 assert_response :success
32 me = JSON.parse(@response.body)
33 assert_equal false, me['is_active']
36 test "activate an already-active user" do
37 authorize_with :active
39 assert_response :success
40 me = JSON.parse(@response.body)
41 post :activate, uuid: me['uuid']
42 assert_response :success
43 me = JSON.parse(@response.body)
44 assert_equal true, me['is_active']
47 test "respond 401 if given token exists but user record is missing" do
48 authorize_with :valid_token_deleted_user
49 get :current, {format: :json}
53 test "create new user with user as input" do
56 first_name: "test_first_name",
57 last_name: "test_last_name",
58 email: "foo@example.com"
60 assert_response :success
61 created = JSON.parse(@response.body)
62 assert_equal 'test_first_name', created['first_name']
63 assert_not_nil created['uuid'], 'expected uuid for the newly created user'
64 assert_not_nil created['email'], 'expected non-nil email'
65 assert_nil created['identity_url'], 'expected no identity_url'
68 test "create user with user, vm and repo as input" do
70 repo_name = 'test_repo'
74 openid_prefix: 'https://www.google.com/accounts/o8/id',
76 uuid: "this_is_agreeable",
77 first_name: "in_create_test_first_name",
78 last_name: "test_last_name",
79 email: "foo@example.com"
82 assert_response :success
83 response_items = JSON.parse(@response.body)['items']
85 created = find_obj_in_resp response_items, 'User', nil
86 assert_equal 'in_create_test_first_name', created['first_name']
87 assert_not_nil created['uuid'], 'expected non-null uuid for the new user'
88 assert_equal 'this_is_agreeable', created['uuid']
89 assert_not_nil created['email'], 'expected non-nil email'
90 assert_nil created['identity_url'], 'expected no identity_url'
92 # arvados#user, repo link and link add user to 'All users' group
93 verify_num_links @all_links_at_start, 4
95 verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
96 created['uuid'], created['email'], 'arvados#user', false, 'User'
98 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
99 repo_name, created['uuid'], 'arvados#repository', true, 'Repository'
101 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
102 'All users', created['uuid'], 'arvados#group', true, 'Group'
104 verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
105 nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
107 verify_system_group_permission_link_for created['uuid']
109 # invoke setup again with the same data
111 repo_name: repo_name,
113 openid_prefix: 'https://www.google.com/accounts/o8/id',
115 uuid: "this_is_agreeable",
116 first_name: "in_create_test_first_name",
117 last_name: "test_last_name",
118 email: "foo@example.com"
122 response_items = JSON.parse(@response.body)['items']
124 created = find_obj_in_resp response_items, 'User', nil
125 assert_equal 'in_create_test_first_name', created['first_name']
126 assert_not_nil created['uuid'], 'expected non-null uuid for the new user'
127 assert_equal 'this_is_agreeable', created['uuid']
128 assert_not_nil created['email'], 'expected non-nil email'
129 assert_nil created['identity_url'], 'expected no identity_url'
131 # arvados#user, repo link and link add user to 'All users' group
132 verify_num_links @all_links_at_start, 5
134 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
135 repo_name, created['uuid'], 'arvados#repository', true, 'Repository'
137 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
138 'All users', created['uuid'], 'arvados#group', true, 'Group'
140 verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
141 @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
143 verify_system_group_permission_link_for created['uuid']
146 test "setup user with bogus uuid and expect error" do
147 authorize_with :admin
151 repo_name: 'test_repo',
154 response_body = JSON.parse(@response.body)
155 response_errors = response_body['errors']
156 assert_not_nil response_errors, 'Expected error in response'
157 assert (response_errors.first.include? 'Path not found'), 'Expected 404'
160 test "setup user with bogus uuid in user and expect error" do
161 authorize_with :admin
164 user: {uuid: 'bogus_uuid'},
165 repo_name: 'test_repo',
167 openid_prefix: 'https://www.google.com/accounts/o8/id'
169 response_body = JSON.parse(@response.body)
170 response_errors = response_body['errors']
171 assert_not_nil response_errors, 'Expected error in response'
172 assert (response_errors.first.include? 'ArgumentError: Require user email'),
173 'Expected RuntimeError'
176 test "setup user with no uuid and user, expect error" do
177 authorize_with :admin
180 repo_name: 'test_repo',
182 openid_prefix: 'https://www.google.com/accounts/o8/id'
184 response_body = JSON.parse(@response.body)
185 response_errors = response_body['errors']
186 assert_not_nil response_errors, 'Expected error in response'
187 assert (response_errors.first.include? 'Required uuid or user'),
188 'Expected ArgumentError'
191 test "setup user with no uuid and email, expect error" do
192 authorize_with :admin
196 repo_name: 'test_repo',
198 openid_prefix: 'https://www.google.com/accounts/o8/id'
200 response_body = JSON.parse(@response.body)
201 response_errors = response_body['errors']
202 assert_not_nil response_errors, 'Expected error in response'
203 assert (response_errors.first.include? '<ArgumentError: Require user email'),
204 'Expected ArgumentError'
207 test "invoke setup with existing uuid, vm and repo and verify links" do
208 authorize_with :inactive
210 assert_response :success
211 inactive_user = JSON.parse(@response.body)
213 authorize_with :admin
216 uuid: inactive_user['uuid'],
217 repo_name: 'test_repo',
221 assert_response :success
223 response_items = JSON.parse(@response.body)['items']
224 resp_obj = find_obj_in_resp response_items, 'User', nil
226 assert_not_nil resp_obj['uuid'], 'expected uuid for the new user'
227 assert_equal inactive_user['uuid'], resp_obj['uuid']
228 assert_equal inactive_user['email'], resp_obj['email'],
229 'expecting inactive user email'
231 # expect repo and vm links
232 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
233 'test_repo', resp_obj['uuid'], 'arvados#repository', true, 'Repository'
235 verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
236 @vm_uuid, resp_obj['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
239 test "invoke setup with existing uuid in user, verify response" do
240 authorize_with :inactive
242 assert_response :success
243 inactive_user = JSON.parse(@response.body)
245 authorize_with :admin
248 user: {uuid: inactive_user['uuid']},
249 openid_prefix: 'https://www.google.com/accounts/o8/id'
252 assert_response :success
254 response_items = JSON.parse(@response.body)['items']
255 resp_obj = find_obj_in_resp response_items, 'User', nil
257 assert_not_nil resp_obj['uuid'], 'expected uuid for the new user'
258 assert_equal inactive_user['uuid'], resp_obj['uuid']
259 assert_equal inactive_user['email'], resp_obj['email'],
260 'expecting inactive user email'
263 test "invoke setup with existing uuid but different email, expect original email" do
264 authorize_with :inactive
266 assert_response :success
267 inactive_user = JSON.parse(@response.body)
269 authorize_with :admin
272 uuid: inactive_user['uuid'],
273 user: {email: 'junk_email'}
276 assert_response :success
278 response_items = JSON.parse(@response.body)['items']
279 resp_obj = find_obj_in_resp response_items, 'User', nil
281 assert_not_nil resp_obj['uuid'], 'expected uuid for the new user'
282 assert_equal inactive_user['uuid'], resp_obj['uuid']
283 assert_equal inactive_user['email'], resp_obj['email'],
284 'expecting inactive user email'
287 test "setup user with valid email and repo as input" do
288 authorize_with :admin
291 repo_name: 'test_repo',
292 user: {email: 'foo@example.com'},
293 openid_prefix: 'https://www.google.com/accounts/o8/id'
296 assert_response :success
297 response_items = JSON.parse(@response.body)['items']
298 response_object = find_obj_in_resp response_items, 'User', nil
299 assert_not_nil response_object['uuid'], 'expected uuid for the new user'
300 assert_equal response_object['email'], 'foo@example.com', 'expected given email'
302 # four extra links; system_group, login, group and repo perms
303 verify_num_links @all_links_at_start, 4
306 test "setup user with fake vm and expect error" do
307 authorize_with :admin
310 repo_name: 'test_repo',
311 vm_uuid: 'no_such_vm',
312 user: {email: 'foo@example.com'},
313 openid_prefix: 'https://www.google.com/accounts/o8/id'
316 response_body = JSON.parse(@response.body)
317 response_errors = response_body['errors']
318 assert_not_nil response_errors, 'Expected error in response'
319 assert (response_errors.first.include? "No vm found for no_such_vm"),
320 'Expected RuntimeError: No vm found for no_such_vm'
323 test "setup user with valid email, repo and real vm as input" do
324 authorize_with :admin
327 repo_name: 'test_repo',
328 openid_prefix: 'https://www.google.com/accounts/o8/id',
330 user: {email: 'foo@example.com'}
333 assert_response :success
334 response_items = JSON.parse(@response.body)['items']
335 response_object = find_obj_in_resp response_items, 'User', nil
336 assert_not_nil response_object['uuid'], 'expected uuid for the new user'
337 assert_equal response_object['email'], 'foo@example.com', 'expected given email'
339 # five extra links; system_group, login, group, vm, repo
340 verify_num_links @all_links_at_start, 5
343 test "setup user with valid email, no vm and repo as input" do
344 authorize_with :admin
347 user: {email: 'foo@example.com'},
348 openid_prefix: 'https://www.google.com/accounts/o8/id'
351 assert_response :success
352 response_items = JSON.parse(@response.body)['items']
353 response_object = find_obj_in_resp response_items, 'User', nil
354 assert_not_nil response_object['uuid'], 'expected uuid for new user'
355 assert_equal response_object['email'], 'foo@example.com', 'expected given email'
357 # three extra links; system_group, login, and group
358 verify_num_links @all_links_at_start, 3
361 test "setup user with email, first name, repo name and vm uuid" do
362 authorize_with :admin
365 openid_prefix: 'https://www.google.com/accounts/o8/id',
366 repo_name: 'test_repo',
369 first_name: 'test_first_name',
370 email: 'foo@example.com'
374 assert_response :success
375 response_items = JSON.parse(@response.body)['items']
376 response_object = find_obj_in_resp response_items, 'User', nil
377 assert_not_nil response_object['uuid'], 'expected uuid for new user'
378 assert_equal response_object['email'], 'foo@example.com', 'expected given email'
379 assert_equal 'test_first_name', response_object['first_name'],
380 'expecting first name'
382 # five extra links; system_group, login, group, repo and vm
383 verify_num_links @all_links_at_start, 5
386 test "setup user twice with email and check two different objects created" do
387 authorize_with :admin
390 openid_prefix: 'https://www.google.com/accounts/o8/id',
391 repo_name: 'test_repo',
393 email: 'foo@example.com'
397 assert_response :success
398 response_items = JSON.parse(@response.body)['items']
399 response_object = find_obj_in_resp response_items, 'User', nil
400 assert_not_nil response_object['uuid'], 'expected uuid for new user'
401 assert_equal response_object['email'], 'foo@example.com', 'expected given email'
402 # system_group, openid, group, and repo. No vm link.
403 verify_num_links @all_links_at_start, 4
407 user: {email: 'foo@example.com'},
408 openid_prefix: 'https://www.google.com/accounts/o8/id'
411 assert_response :success
412 response_items = JSON.parse(@response.body)['items']
413 response_object2 = find_obj_in_resp response_items, 'User', nil
414 assert_not_equal response_object['uuid'], response_object2['uuid'],
415 'expected same uuid as first create operation'
416 assert_equal response_object['email'], 'foo@example.com', 'expected given email'
418 # +1 extra login link +1 extra system_group link pointing to the new User
419 verify_num_links @all_links_at_start, 6
422 test "setup user with openid prefix" do
423 authorize_with :admin
426 repo_name: 'test_repo',
427 openid_prefix: 'http://www.example.com/account',
429 first_name: "in_create_test_first_name",
430 last_name: "test_last_name",
431 email: "foo@example.com"
435 assert_response :success
437 response_items = JSON.parse(@response.body)['items']
438 created = find_obj_in_resp response_items, 'User', nil
440 assert_equal 'in_create_test_first_name', created['first_name']
441 assert_not_nil created['uuid'], 'expected uuid for new user'
442 assert_not_nil created['email'], 'expected non-nil email'
443 assert_nil created['identity_url'], 'expected no identity_url'
446 # four new links: system_group, arvados#user, repo, and 'All users' group.
447 verify_num_links @all_links_at_start, 4
449 verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
450 created['uuid'], created['email'], 'arvados#user', false, 'User'
452 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
453 'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
455 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
456 'All users', created['uuid'], 'arvados#group', true, 'Group'
458 verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
459 nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
462 test "invoke setup with no openid prefix, expect error" do
463 authorize_with :admin
466 repo_name: 'test_repo',
468 first_name: "in_create_test_first_name",
469 last_name: "test_last_name",
470 email: "foo@example.com"
474 response_body = JSON.parse(@response.body)
475 response_errors = response_body['errors']
476 assert_not_nil response_errors, 'Expected error in response'
477 assert (response_errors.first.include? 'openid_prefix parameter is missing'),
478 'Expected ArgumentError'
481 test "setup user with user, vm and repo and verify links" do
482 authorize_with :admin
486 first_name: "in_create_test_first_name",
487 last_name: "test_last_name",
488 email: "foo@example.com"
491 repo_name: 'test_repo',
492 openid_prefix: 'https://www.google.com/accounts/o8/id'
495 assert_response :success
497 response_items = JSON.parse(@response.body)['items']
498 created = find_obj_in_resp response_items, 'User', nil
500 assert_equal 'in_create_test_first_name', created['first_name']
501 assert_not_nil created['uuid'], 'expected uuid for new user'
502 assert_not_nil created['email'], 'expected non-nil email'
503 assert_nil created['identity_url'], 'expected no identity_url'
505 # five new links: system_group, arvados#user, repo, vm and 'All
507 verify_num_links @all_links_at_start, 5
509 verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
510 created['uuid'], created['email'], 'arvados#user', false, 'User'
512 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
513 'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
515 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
516 'All users', created['uuid'], 'arvados#group', true, 'Group'
518 verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
519 @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
522 test "create user as non admin user and expect error" do
523 authorize_with :active
526 user: {email: 'foo@example.com'}
529 response_body = JSON.parse(@response.body)
530 response_errors = response_body['errors']
531 assert_not_nil response_errors, 'Expected error in response'
532 assert (response_errors.first.include? 'PermissionDenied'),
533 'Expected PermissionDeniedError'
536 test "setup user as non admin user and expect error" do
537 authorize_with :active
540 openid_prefix: 'https://www.google.com/accounts/o8/id',
541 user: {email: 'foo@example.com'}
544 response_body = JSON.parse(@response.body)
545 response_errors = response_body['errors']
546 assert_not_nil response_errors, 'Expected error in response'
547 assert (response_errors.first.include? 'Forbidden'),
548 'Expected Forbidden error'
551 test "setup user in multiple steps and verify response" do
552 authorize_with :admin
555 openid_prefix: 'http://www.example.com/account',
557 email: "foo@example.com"
561 assert_response :success
562 response_items = JSON.parse(@response.body)['items']
563 created = find_obj_in_resp response_items, 'User', nil
565 assert_not_nil created['uuid'], 'expected uuid for new user'
566 assert_not_nil created['email'], 'expected non-nil email'
567 assert_equal created['email'], 'foo@example.com', 'expected input email'
569 # three new links: system_group, arvados#user, and 'All users' group.
570 verify_num_links @all_links_at_start, 3
572 verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
573 created['uuid'], created['email'], 'arvados#user', false, 'User'
575 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
576 'All users', created['uuid'], 'arvados#group', true, 'Group'
578 verify_link response_items, 'arvados#repository', false, 'permission', 'can_write',
579 'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
581 verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
582 nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
584 # invoke setup with a repository
586 openid_prefix: 'http://www.example.com/account',
587 repo_name: 'new_repo',
588 uuid: created['uuid']
591 assert_response :success
593 response_items = JSON.parse(@response.body)['items']
594 created = find_obj_in_resp response_items, 'User', nil
596 assert_equal 'foo@example.com', created['email'], 'expected input email'
599 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
600 'All users', created['uuid'], 'arvados#group', true, 'Group'
602 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
603 'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
605 verify_link response_items, 'arvados#virtualMachine', false, 'permission', 'can_login',
606 nil, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
608 # invoke setup with a vm_uuid
611 openid_prefix: 'http://www.example.com/account',
615 uuid: created['uuid']
618 assert_response :success
620 response_items = JSON.parse(@response.body)['items']
621 created = find_obj_in_resp response_items, 'User', nil
623 assert_equal created['email'], 'foo@example.com', 'expected original email'
626 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
627 'All users', created['uuid'], 'arvados#group', true, 'Group'
629 # since no repo name in input, we won't get any; even though user has one
630 verify_link response_items, 'arvados#repository', false, 'permission', 'can_write',
631 'new_repo', created['uuid'], 'arvados#repository', true, 'Repository'
633 verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
634 @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
637 test "setup and unsetup user" do
638 authorize_with :admin
641 repo_name: 'test_repo',
643 user: {email: 'foo@example.com'},
644 openid_prefix: 'https://www.google.com/accounts/o8/id'
647 assert_response :success
648 response_items = JSON.parse(@response.body)['items']
649 created = find_obj_in_resp response_items, 'User', nil
650 assert_not_nil created['uuid'], 'expected uuid for the new user'
651 assert_equal created['email'], 'foo@example.com', 'expected given email'
653 # five extra links: system_group, login, group, repo and vm
654 verify_num_links @all_links_at_start, 5
656 verify_link response_items, 'arvados#user', true, 'permission', 'can_login',
657 created['uuid'], created['email'], 'arvados#user', false, 'User'
659 verify_link response_items, 'arvados#group', true, 'permission', 'can_read',
660 'All users', created['uuid'], 'arvados#group', true, 'Group'
662 verify_link response_items, 'arvados#repository', true, 'permission', 'can_write',
663 'test_repo', created['uuid'], 'arvados#repository', true, 'Repository'
665 verify_link response_items, 'arvados#virtualMachine', true, 'permission', 'can_login',
666 @vm_uuid, created['uuid'], 'arvados#virtualMachine', false, 'VirtualMachine'
668 verify_link_existence created['uuid'], created['email'], true, true, true, true, false
670 # now unsetup this user
671 post :unsetup, uuid: created['uuid']
672 assert_response :success
674 created2 = JSON.parse(@response.body)
675 assert_not_nil created2['uuid'], 'expected uuid for the newly created user'
676 assert_equal created['uuid'], created2['uuid'], 'expected uuid not found'
678 verify_link_existence created['uuid'], created['email'], false, false, false, false, false
681 test "unsetup active user" do
682 authorize_with :active
684 assert_response :success
685 active_user = JSON.parse(@response.body)
686 assert_not_nil active_user['uuid'], 'expected uuid for the active user'
687 assert active_user['is_active'], 'expected is_active for active user'
688 assert active_user['is_invited'], 'expected is_invited for active user'
690 verify_link_existence active_user['uuid'], active_user['email'],
691 false, false, false, true, true
693 authorize_with :admin
695 # now unsetup this user
696 post :unsetup, uuid: active_user['uuid']
697 assert_response :success
699 response_user = JSON.parse(@response.body)
700 assert_not_nil response_user['uuid'], 'expected uuid for the upsetup user'
701 assert_equal active_user['uuid'], response_user['uuid'], 'expected uuid not found'
702 assert !response_user['is_active'], 'expected user to be inactive'
703 assert !response_user['is_invited'], 'expected user to be uninvited'
705 verify_link_existence response_user['uuid'], response_user['email'],
706 false, false, false, false, false
709 def verify_num_links (original_links, expected_additional_links)
711 assert_equal expected_additional_links, Link.all.size-original_links.size,
712 "Expected #{expected_additional_links.inspect} more links"
715 def find_obj_in_resp (response_items, object_type, head_kind=nil)
717 response_items.each { |x|
722 if object_type == 'User'
727 else # looking for a link
728 if x['head_kind'] == head_kind
737 def verify_link(response_items, link_object_name, expect_link, link_class,
738 link_name, head_uuid, tail_uuid, head_kind, fetch_object, class_name)
740 link = find_obj_in_resp response_items, 'Link', link_object_name
743 assert_nil link, "Expected no link for #{link_object_name}"
747 assert_not_nil link, "Expected link for #{link_object_name}"
750 object = Object.const_get(class_name).where(name: head_uuid)
751 assert [] != object, "expected #{class_name} with name #{head_uuid}"
752 head_uuid = object.first[:uuid]
754 assert_equal link['link_class'], link_class,
755 "did not find expected link_class for #{link_object_name}"
757 assert_equal link['name'], link_name,
758 "did not find expected link_name for #{link_object_name}"
760 assert_equal link['tail_uuid'], tail_uuid,
761 "did not find expected tail_uuid for #{link_object_name}"
763 assert_equal link['head_kind'], head_kind,
764 "did not find expected head_kind for #{link_object_name}"
766 assert_equal link['head_uuid'], head_uuid,
767 "did not find expected head_uuid for #{link_object_name}"
770 def verify_link_existence uuid, email, expect_oid_login_perms,
771 expect_repo_perms, expect_vm_perms, expect_group_perms, expect_signatures
772 # verify that all links are deleted for the user
773 oid_login_perms = Link.where(tail_uuid: email,
774 head_kind: 'arvados#user',
775 link_class: 'permission',
777 if expect_oid_login_perms
778 assert oid_login_perms.any?, "expected oid_login_perms"
780 assert !oid_login_perms.any?, "expected all oid_login_perms deleted"
783 repo_perms = Link.where(tail_uuid: uuid,
784 head_kind: 'arvados#repository',
785 link_class: 'permission',
788 assert repo_perms.any?, "expected repo_perms"
790 assert !repo_perms.any?, "expected all repo_perms deleted"
793 vm_login_perms = Link.where(tail_uuid: uuid,
794 head_kind: 'arvados#virtualMachine',
795 link_class: 'permission',
798 assert vm_login_perms.any?, "expected vm_login_perms"
800 assert !vm_login_perms.any?, "expected all vm_login_perms deleted"
803 group = Group.where(name: 'All users').select do |g|
804 g[:uuid].match /-f+$/
806 group_read_perms = Link.where(tail_uuid: uuid,
807 head_uuid: group[:uuid],
808 head_kind: 'arvados#group',
809 link_class: 'permission',
811 if expect_group_perms
812 assert group_read_perms.any?, "expected all users group read perms"
814 assert !group_read_perms.any?, "expected all users group perm deleted"
817 signed_uuids = Link.where(link_class: 'signature',
818 tail_kind: 'arvados#user',
822 assert signed_uuids.any?, "expected signatures"
824 assert !signed_uuids.any?, "expected all signatures deleted"
829 def verify_system_group_permission_link_for user_uuid
830 assert_equal 1, Link.where(link_class: 'permission',
832 tail_uuid: system_group_uuid,
833 head_uuid: user_uuid).count