[ARVADOS] created: 7eae56ffb9db24d6cdbc931b29453f2f7bfa1618
git at public.curoverse.com
git at public.curoverse.com
Fri Feb 13 13:45:00 EST 2015
at 7eae56ffb9db24d6cdbc931b29453f2f7bfa1618 (commit)
commit 7eae56ffb9db24d6cdbc931b29453f2f7bfa1618
Author: Radhika Chippada <radhika at curoverse.com>
Date: Fri Feb 13 13:43:13 2015 -0500
4759: add a getter method for collection.modified_at attribute with the format to include milliseconds in api response returned.
diff --git a/services/api/app/models/collection.rb b/services/api/app/models/collection.rb
index 334f3c6..7c93d0b 100644
--- a/services/api/app/models/collection.rb
+++ b/services/api/app/models/collection.rb
@@ -317,6 +317,10 @@ class Collection < ArvadosModel
super - ["manifest_text"]
end
+ def modified_at
+ self[:modified_at].strftime "%Y-%m-%dT%H:%M:%S.%NZ" if self[:modified_at]
+ end
+
protected
def portable_manifest_text
portable_manifest = self[:manifest_text].dup
diff --git a/services/api/test/integration/collections_api_test.rb b/services/api/test/integration/collections_api_test.rb
index 93ed156..1a9e7a2 100644
--- a/services/api/test/integration/collections_api_test.rb
+++ b/services/api/test/integration/collections_api_test.rb
@@ -202,6 +202,7 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
refute_empty response_items
first_item = response_items.first
assert_not_nil first_item
+ return first_item
end
end
@@ -273,4 +274,29 @@ class CollectionsApiTest < ActionDispatch::IntegrationTest
assert_equal first_item['description'], 'The quick_brown_fox jumps over the lazy_dog'
end
end
+
+ test "verify modified_at time format after create, update, and get" do
+ # create collection
+ signed_manifest = Collection.sign_manifest(". bad42fa702ae3ea7d888fef11b46f450+44 0:44:my_test_file.txt\n", api_token(:active))
+ post "/arvados/v1/collections", {
+ format: :json,
+ collection: {manifest_text: signed_manifest}.to_json,
+ }, auth(:active)
+ assert_response :success
+ assert_match /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}/, json_response['modified_at']
+ created = json_response
+
+ # update the collection's manifest text
+ signed_manifest = Collection.sign_manifest(". bad42fa702ae3ea7d888fef11b46f450+44 0:44:my_updated_test_file.txt\n", api_token(:active))
+ put "/arvados/v1/collections/#{created['uuid']}", {
+ format: :json,
+ collection: {manifest_text: signed_manifest}.to_json,
+ }, auth(:active)
+ assert_response :success
+ assert_match /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}/, json_response['modified_at']
+
+ # search using filename
+ search_result = search_using_filter 'my_updated_test_file.txt', 1
+ assert_match /\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{6}/, search_result['modified_at']
+ end
end
diff --git a/services/api/test/unit/collection_test.rb b/services/api/test/unit/collection_test.rb
index 59f9d3d..2485d4d 100644
--- a/services/api/test/unit/collection_test.rb
+++ b/services/api/test/unit/collection_test.rb
@@ -57,7 +57,7 @@ class CollectionTest < ActiveSupport::TestCase
[2**8, false],
[2**18, true],
].each do |manifest_size, gets_truncated|
- test "create collection with manifest size #{manifest_size} which gets truncated #{gets_truncated},
+ test "create collection with manifest size #{manifest_size}, file_names gets truncated #{gets_truncated},
and not expect exceptions even on very large manifest texts" do
# file_names has a max size, hence there will be no errors even on large manifests
act_as_system_user do
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list