X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/2d4198a095e193102daa2710c6b2baba7be7c9ce..d5524135b1495b919de332df4f952926664961f5:/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb diff --git a/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb b/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb index 8ca2a94c8d..329bc1589a 100644 --- a/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb +++ b/services/api/test/functional/arvados/v1/virtual_machines_controller_test.rb @@ -44,4 +44,32 @@ class Arvados::V1::VirtualMachinesControllerTest < ActionController::TestCase assert_empty(json_response. select { |login| login["user_uuid"] == spectator_uuid }) end + + test "logins without ssh keys are listed" do + u, vm = nil + act_as_system_user do + u = create :active_user, first_name: 'Bob', last_name: 'Blogin' + vm = VirtualMachine.create! hostname: 'foo.shell' + Link.create!(tail_uuid: u.uuid, + head_uuid: vm.uuid, + link_class: 'permission', + name: 'can_login', + properties: {'username' => 'bobblogin'}) + end + authorize_with :admin + get :logins, id: vm.uuid + assert_response :success + assert_equal 1, json_response['items'].length + assert_equal nil, json_response['items'][0]['public_key'] + assert_equal nil, json_response['items'][0]['authorized_key_uuid'] + assert_equal u.uuid, json_response['items'][0]['user_uuid'] + assert_equal 'bobblogin', json_response['items'][0]['username'] + end + + test 'get all logins' do + authorize_with :admin + get :get_all_logins + find_login :admin + find_login :active + end end