[ARVADOS] updated: 34ac761cb1fd2b7b9438765d14ded85dfab0453b

git at public.curoverse.com git at public.curoverse.com
Sat May 10 14:56:32 EDT 2014


Summary of changes:
 services/api/test/unit/owner_test.rb | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

       via  34ac761cb1fd2b7b9438765d14ded85dfab0453b (commit)
      from  e19b02f69914c086f979ec31eb603bb3b456cd15 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 34ac761cb1fd2b7b9438765d14ded85dfab0453b
Author: Tom Clegg <tom at curoverse.com>
Date:   Sat May 10 14:55:57 2014 -0400

    2762: Test assigning random non-existent owner_uuids to new objects.

diff --git a/services/api/test/unit/owner_test.rb b/services/api/test/unit/owner_test.rb
index 2cb4063..df96f31 100644
--- a/services/api/test/unit/owner_test.rb
+++ b/services/api/test/unit/owner_test.rb
@@ -24,6 +24,20 @@ class OwnerTest < ActiveSupport::TestCase
       assert Specimen.where(uuid: i.uuid).any?, "new item should really be in DB"
     end
 
+    test "create object with non-existent #{o_class} owner" do
+      assert_raises(ActiveRecord::RecordInvalid,
+                    "create should fail with random owner_uuid") do
+        i = Specimen.create!(owner_uuid: o_class.generate_uuid)
+      end
+
+      i = Specimen.create(owner_uuid: o_class.generate_uuid)
+      assert !i.valid?, "object with random owner_uuid should not be valid?"
+
+      i = Specimen.new(owner_uuid: o_class.generate_uuid)
+      assert !i.valid?, "new item should not pass validation"
+      assert !i.uuid, "new item should not have an ID"
+    end
+
     [User, Group].each do |new_o_class|
       test "change owner from legit #{o_class} to legit #{new_o_class} owner" do
         o = o_class.create

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list