assert_includes editables, true, "should have a writable repository"
assert_includes editables, false, "should have a readonly repository"
end
+
+ test "show repositories lists linked as well as owned repositories" do
+ get :manage_account, {}, session_for(:active)
+ assert_response :success
+ repos = assigns(:my_repositories)
+ assert repos
+ repo_writables = assigns(:repo_writable)
+ assert_not_empty repo_writables, "repo_writables should not be empty"
+ assert_includes repo_writables, api_fixture('repositories')['repository4']['uuid'] # writable by active
+ assert_includes repo_writables, api_fixture('repositories')['repository2']['uuid'] # owned by active
+ end
+
+ test "request shell access" do
+ user = api_fixture('users')['spectator']
+
+ ActionMailer::Base.deliveries = []
+
+ post :request_shell_access, {
+ id: user['uuid'],
+ format: 'js'
+ }, session_for(:spectator)
+ assert_response :success
+
+ full_name = "#{user['first_name']} #{user['last_name']}"
+ expected = "Shell account request from #{full_name} (#{user['email']}, #{user['uuid']})"
+ found_email = 0
+ ActionMailer::Base.deliveries.each do |email|
+ if email.subject.include?(expected)
+ found_email += 1
+ break
+ end
+ end
+ assert_equal 1, found_email, "Expected 1 email after requesting shell access"
+ end
end