1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: AGPL-3.0
7 class Arvados::V1::UserAgreementsControllerTest < ActionController::TestCase
9 test "active user get user agreements" do
10 authorize_with :active
12 assert_response :success
13 assert_not_nil assigns(:objects)
14 agreements_list = JSON.parse(@response.body)
15 assert_not_nil agreements_list['items']
16 assert_not_nil agreements_list['items'][0]
19 test "active user get user agreement signatures" do
20 authorize_with :active
22 assert_response :success
23 assert_not_nil assigns(:objects)
24 agreements_list = JSON.parse(@response.body)
25 assert_not_nil agreements_list['items']
26 assert_not_nil agreements_list['items'][0]
27 assert_equal 1, agreements_list['items'].count
30 test "inactive user get user agreements" do
31 authorize_with :inactive
33 assert_response :success
34 assert_not_nil assigns(:objects)
35 agreements_list = JSON.parse(@response.body)
36 assert_not_nil agreements_list['items']
37 assert_not_nil agreements_list['items'][0]
40 test "uninvited user receives empty list of user agreements" do
41 authorize_with :inactive_uninvited
43 assert_response :success
44 assert_not_nil assigns(:objects)
45 agreements_list = JSON.parse(@response.body)
46 assert_not_nil agreements_list['items']
47 assert_nil agreements_list['items'][0]