1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class Arvados::V1::LogsControllerTest < ActionController::TestCase
10 test "non-admins can create their own logs" do
11 authorize_with :active
12 post :create, log: {summary: 'test log'}
13 assert_response :success
14 resp = assigns(:object)
15 assert_not_nil resp.uuid
16 assert_equal('test log', resp.summary, "loaded wrong log after creation")
19 test "non-admins can read their own logs" do
20 authorize_with :active
21 my_log = logs(:log_owned_by_active)
22 get :show, {id: my_log[:uuid]}
23 assert_response(:success, "failed to get log")
24 resp = assigns(:object)
25 assert_equal(my_log[:summary], resp.summary, "got wrong log")
28 test "test can still use where object_kind" do
31 where: { object_kind: 'arvados#user' }
33 assert_response :success
34 found = assigns(:objects)
35 assert_not_equal 0, found.count
36 assert_equal found.count, (found.select { |f| f.object_uuid.match User.uuid_regex }).count
37 l = JSON.parse(@response.body)
38 assert_equal 'arvados#user', l['items'][0]['object_kind']
41 test "test can still use filter object_kind" do
44 filters: [ ['object_kind', '=', 'arvados#user'] ]
46 assert_response :success
47 found = assigns(:objects)
48 assert_not_equal 0, found.count
49 assert_equal found.count, (found.select { |f| f.object_uuid.match User.uuid_regex }).count