1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class UserTest < ActiveSupport::TestCase
8 test "can select specific user columns" do
10 User.select(["uuid", "is_active"]).limit(5).each do |user|
11 assert_not_nil user.uuid
12 assert_not_nil user.is_active
13 assert_nil user.first_name
17 test "User.current doesn't return anonymous user when using invalid token" do
18 # Set up anonymous user token
19 Rails.configuration.Users.AnonymousUserToken = api_fixture('api_client_authorizations')['anonymous']['api_token']
20 # First, try with a valid user
23 assert(find_fixture(User, "active").uuid == u.uuid)
24 # Next, simulate an invalid token
25 Thread.current[:arvados_api_token] = 'thistokenwontwork'
26 assert_raises(ArvadosApiClient::NotLoggedInException) do