verify_link_existence response_user['uuid'], response_user['email'],
false, false, false, false, false
+
+ active_user = User.find_by_uuid(users(:active).uuid)
+ readable_groups = active_user.groups_i_can(:read)
+ all_users_group = Group.all.collect(&:uuid).select { |g| g.match /-f+$/ }
+ refute_includes(readable_groups, all_users_group,
+ "active user can read All Users group after being deactivated")
+ assert_equal(false, active_user.is_invited,
+ "active user is_invited after being deactivated & reloaded")
end
test "setup user with send notification param false and verify no email" do
check_active_users_index
end
+ test "update active_no_prefs user profile and expect notification email" do
+ authorize_with :admin
+
+ put :update, {
+ id: users(:active_no_prefs).uuid,
+ user: {
+ prefs: {:profile => {'organization' => 'example.com'}}
+ }
+ }
+ assert_response :success
+
+ found_email = false
+ ActionMailer::Base.deliveries.andand.each do |email|
+ if email.subject == "Profile created by #{users(:active_no_prefs).email}"
+ found_email = true
+ break
+ end
+ end
+ assert_equal true, found_email, 'Expected email after creating profile'
+ end
+
+ test "update active_no_prefs_profile user profile and expect notification email" do
+ authorize_with :admin
+
+ user = {}
+ user[:prefs] = users(:active_no_prefs_profile).prefs
+ user[:prefs][:profile] = {:profile => {'organization' => 'example.com'}}
+ put :update, {
+ id: users(:active_no_prefs_profile).uuid,
+ user: user
+ }
+ assert_response :success
+
+ found_email = false
+ ActionMailer::Base.deliveries.andand.each do |email|
+ if email.subject == "Profile created by #{users(:active_no_prefs_profile).email}"
+ found_email = true
+ break
+ end
+ end
+ assert_equal true, found_email, 'Expected email after creating profile'
+ end
+
+ test "update active user profile and expect no notification email" do
+ authorize_with :admin
+
+ put :update, {
+ id: users(:active).uuid,
+ user: {
+ prefs: {:profile => {'organization' => 'anotherexample.com'}}
+ }
+ }
+ assert_response :success
+
+ found_email = false
+ ActionMailer::Base.deliveries.andand.each do |email|
+ if email.subject == "Profile created by #{users(:active).email}"
+ found_email = true
+ break
+ end
+ end
+ assert_equal false, found_email, 'Expected no email after updating profile'
+ end
+
+
NON_ADMIN_USER_DATA = ["uuid", "kind", "is_active", "email", "first_name",
"last_name"].sort
assert !repo_perms.any?, "expected all repo_perms deleted"
end
- vm_login_perms = Link.where(tail_uuid: uuid,
- link_class: 'permission',
- name: 'can_login').where("head_uuid like ?", VirtualMachine.uuid_like_pattern)
+ vm_login_perms = Link.
+ where(tail_uuid: uuid,
+ link_class: 'permission',
+ name: 'can_login').
+ where("head_uuid like ?",
+ VirtualMachine.uuid_like_pattern).
+ where('uuid <> ?',
+ links(:auto_setup_vm_login_username_can_login_to_test_vm).uuid)
if expect_vm_perms
assert vm_login_perms.any?, "expected vm_login_perms"
else
g[:uuid].match /-f+$/
end.first
group_read_perms = Link.where(tail_uuid: uuid,
- head_uuid: group[:uuid],
- link_class: 'permission',
- name: 'can_read')
+ head_uuid: group[:uuid],
+ link_class: 'permission',
+ name: 'can_read')
if expect_group_perms
assert group_read_perms.any?, "expected all users group read perms"
else
end
signed_uuids = Link.where(link_class: 'signature',
- tail_uuid: uuid)
+ tail_uuid: uuid)
if expect_signatures
assert signed_uuids.any?, "expected signatures"