3 class ArvadosModelTest < ActiveSupport::TestCase
6 def create_with_attrs attrs
7 a = Specimen.create({material: 'caloric'}.merge(attrs))
11 test 'non-admin cannot assign uuid' do
12 set_user_from_auth :active_trustedclient
13 want_uuid = Specimen.generate_uuid
14 a = create_with_attrs(uuid: want_uuid)
15 assert_not_equal want_uuid, a.uuid, "Non-admin should not assign uuid."
16 assert a.uuid.length==27, "Auto assigned uuid length is wrong."
19 test 'admin can assign valid uuid' do
20 set_user_from_auth :admin_trustedclient
21 want_uuid = Specimen.generate_uuid
22 a = create_with_attrs(uuid: want_uuid)
23 assert_equal want_uuid, a.uuid, "Admin should assign valid uuid."
24 assert a.uuid.length==27, "Auto assigned uuid length is wrong."
27 test 'admin cannot assign empty uuid' do
28 set_user_from_auth :admin_trustedclient
29 a = create_with_attrs(uuid: "")
30 assert_not_equal "", a.uuid, "Admin should not assign empty uuid."
31 assert a.uuid.length==27, "Auto assigned uuid length is wrong."