3 class Arvados::V1::UsersControllerTest < ActionController::TestCase
5 test "activate a user after signing UA" do
6 authorize_with :inactive_but_signed_user_agreement
8 assert_response :success
9 me = JSON.parse(@response.body)
10 post :activate, uuid: me['uuid']
11 assert_response :success
12 assert_not_nil assigns(:object)
13 me = JSON.parse(@response.body)
14 assert_equal true, me['is_active']
17 test "refuse to activate a user before signing UA" do
18 authorize_with :inactive
20 assert_response :success
21 me = JSON.parse(@response.body)
22 post :activate, uuid: me['uuid']
25 assert_response :success
26 me = JSON.parse(@response.body)
27 assert_equal false, me['is_active']
30 test "activate an already-active user" do
31 authorize_with :active
33 assert_response :success
34 me = JSON.parse(@response.body)
35 post :activate, uuid: me['uuid']
36 assert_response :success
37 me = JSON.parse(@response.body)
38 assert_equal true, me['is_active']
41 test "create new user" do
44 first_name: "test_first_name",
45 last_name: "test_last_name",
48 assert_response :success
49 created = JSON.parse(@response.body)
50 assert_equal 'test_first_name', created['first_name']
51 assert_not_nil created['uuid'], 'expected non-null uuid for the newly created user'
52 assert_not_nil created['email'], 'since email was given, expected non-nil email'
53 assert_nil created['identity_url'], 'even though email is provided, expected no identity_url since users_controller only creates user at this time'
56 test "create user with vm and repo" do
60 repo_name: 'test_repo',
63 uuid: "shouldnotbeused",
64 first_name: "in_create_test_first_name",
65 last_name: "test_last_name",
69 assert_response :success
70 created = JSON.parse(@response.body)
71 assert_equal 'in_create_test_first_name', created['first_name']
72 assert_not_nil created['uuid'], 'expected non-null uuid for the newly created user'
73 assert_not_nil created['email'], 'since email was given, expected non-nil email'
74 assert_nil created['identity_url'], 'even though email is provided, expected no identity_url since users_controller only creates user'