[ARVADOS] updated: 27daf08f38eec505c224e7776678b32d50241e13

git at public.curoverse.com git at public.curoverse.com
Wed Aug 5 14:47:30 EDT 2015


Summary of changes:
 apps/workbench/app/controllers/users_controller.rb |  6 ------
 apps/workbench/app/views/layouts/body.html.erb     |  8 +-------
 .../app/views/users/_manage_account.html.erb       | 22 ----------------------
 .../app/views/users/manage_account.html.erb        |  1 -
 apps/workbench/config/routes.rb                    |  1 -
 .../test/integration/application_layout_test.rb    |  2 --
 ..._account_test.rb => user_settings_menu_test.rb} | 19 +++++++++----------
 services/api/app/models/collection.rb              |  6 +++++-
 .../views/user_notifier/account_is_setup.text.erb  |  4 ++--
 .../arvados/v1/collections_controller_test.rb      | 20 +++++++++-----------
 .../functional/arvados/v1/users_controller_test.rb |  3 +--
 services/api/test/unit/collection_test.rb          | 12 ++++++++++--
 12 files changed, 37 insertions(+), 67 deletions(-)
 delete mode 100644 apps/workbench/app/views/users/_manage_account.html.erb
 delete mode 100644 apps/workbench/app/views/users/manage_account.html.erb
 rename apps/workbench/test/integration/{user_manage_account_test.rb => user_settings_menu_test.rb} (94%)

       via  27daf08f38eec505c224e7776678b32d50241e13 (commit)
       via  29d73c8ab33b0d9c34074cd09e581cd7584da31e (commit)
       via  9036e4876fa3710b12a1dfb465652c04b9a73901 (commit)
       via  e76165d4c3b0cb5929bfec08f36a95ecd80cd564 (commit)
       via  48dd255814cfc90a095132b6f621af13430267e0 (commit)
       via  baccfce65b0c997202c22e36a2ebfc455eff0334 (commit)
       via  bdabb9aa520b598107e319e51638f899f136aff5 (commit)
       via  44d4d43331979c87cee5df9ff952fd80a6e9c5f8 (commit)
       via  89fccf123374c67e738381ea840e3535b2d1074f (commit)
      from  559acee1dca5524f9650e360d5f16fc1582a77f0 (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 27daf08f38eec505c224e7776678b32d50241e13
Author: radhika <radhika at curoverse.com>
Date:   Wed Aug 5 14:45:11 2015 -0400

    6277: add default_empty_manifest before_validation filter and update the tests accordingly.

diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index f86cf22..ff58f1f 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -8,6 +8,7 @@ class Collection < ArvadosModel
 
   serialize :properties, Hash
 
+  before_validation :default_empty_manifest
   before_validation :check_encoding
   before_validation :check_manifest_validity
   before_validation :check_signatures
@@ -171,8 +172,11 @@ class Collection < ArvadosModel
     names[0,2**12]
   end
 
+  def default_empty_manifest
+    self.manifest_text ||= ''
+  end
+
   def check_encoding
-    return true if !manifest_text
     if manifest_text.encoding.name == 'UTF-8' and manifest_text.valid_encoding?
       true
     else
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index dac960f..99b0333 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -822,18 +822,17 @@ EOS
       post :create, {
         collection: {
           manifest_text: manifest_text,
-          portable_data_hash: "d30fe8ae534397864cb96c544f4cf102+47"
+          portable_data_hash: "d41d8cd98f00b204e9800998ecf8427e+0"
         }
       }
-      assert_response 422
-      response_errors = json_response['errors']
-      assert_not_nil response_errors, 'Expected error in response'
       if manifest_text
+        assert_response 422
+        response_errors = json_response['errors']
+        assert_not_nil response_errors, 'Expected error in response'
         assert(response_errors.first.include?('Invalid manifest'),
                "Expected 'Invalid manifest' error in #{response_errors.first}")
       else
-        assert(response_errors.first.include?('No manifest found'),
-               "Expected 'No manifest found' error in #{response_errors.first}")
+        assert_response 200
       end
     end
   end
@@ -853,15 +852,14 @@ EOS
           manifest_text: manifest_text,
         }
       }
-      assert_response 422
-      response_errors = json_response['errors']
-      assert_not_nil response_errors, 'Expected error in response'
       if manifest_text
+        assert_response 422
+        response_errors = json_response['errors']
+        assert_not_nil response_errors, 'Expected error in response'
         assert(response_errors.first.include?('Invalid manifest'),
                "Expected 'Invalid manifest' error in #{response_errors.first}")
       else
-        assert(response_errors.first.include?('No manifest found'),
-               "Expected 'No manifest found' error in #{response_errors.first}")
+        assert_response 200
       end
     end
   end
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index d6b50da..0b45144 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -49,7 +49,11 @@ class CollectionTest < ActiveSupport::TestCase
     test "create collection with invalid manifest text #{manifest_text} and expect error" do
       act_as_system_user do
         c = Collection.create(manifest_text: manifest_text)
-        assert !c.valid?
+        if manifest_text
+          assert !c.valid?
+        else
+          assert c.valid?
+        end
       end
     end
   end
@@ -67,7 +71,11 @@ class CollectionTest < ActiveSupport::TestCase
         assert c.valid?
 
         c.update_attribute 'manifest_text', manifest_text
-        assert !c.valid?
+        if manifest_text
+          assert !c.valid?
+        else
+          assert c.valid?
+        end
       end
     end
   end

commit 29d73c8ab33b0d9c34074cd09e581cd7584da31e
Merge: 559acee 9036e48
Author: radhika <radhika at curoverse.com>
Date:   Wed Aug 5 14:29:10 2015 -0400

    Merge branch 'master' into 6277-check_manifest_validity


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


hooks/post-receive
-- 




More information about the arvados-commits mailing list