8784: Fix test for latest firefox.
[arvados.git] / services / api / test / functional / arvados / v1 / logs_controller_test.rb
1 require 'test_helper'
2
3 class Arvados::V1::LogsControllerTest < ActionController::TestCase
4   fixtures :logs
5
6   test "non-admins can create their own logs" do
7     authorize_with :active
8     post :create, log: {summary: 'test log'}
9     assert_response :success
10     resp = assigns(:object)
11     assert_not_nil resp.uuid
12     assert_equal('test log', resp.summary, "loaded wrong log after creation")
13   end
14
15   test "non-admins can read their own logs" do
16     authorize_with :active
17     my_log = logs(:log_owned_by_active)
18     get :show, {id: my_log[:uuid]}
19     assert_response(:success, "failed to get log")
20     resp = assigns(:object)
21     assert_equal(my_log[:summary], resp.summary, "got wrong log")
22   end
23
24   test "test can still use where object_kind" do
25     authorize_with :admin
26     get :index, {
27       where: { object_kind: 'arvados#user' }
28     }
29     assert_response :success
30     found = assigns(:objects)
31     assert_not_equal 0, found.count
32     assert_equal found.count, (found.select { |f| f.object_uuid.match User.uuid_regex }).count
33     l = JSON.parse(@response.body)
34     assert_equal 'arvados#user', l['items'][0]['object_kind']
35   end
36
37   test "test can still use filter object_kind" do
38     authorize_with :admin
39     get :index, {
40       filters: [ ['object_kind', '=', 'arvados#user'] ]
41     }
42     assert_response :success
43     found = assigns(:objects)
44     assert_not_equal 0, found.count
45     assert_equal found.count, (found.select { |f| f.object_uuid.match User.uuid_regex }).count
46   end
47
48 end