[ARVADOS] updated: 50d3be922d18357f1033b02c7add035fba4acd56

git at public.curoverse.com git at public.curoverse.com
Tue Feb 17 13:33:54 EST 2015


Summary of changes:
 COPYING                                            |   2 +-
 .../app/controllers/collections_controller.rb      |   9 ++
 apps/workbench/app/controllers/users_controller.rb |  13 ++-
 apps/workbench/app/views/collections/show.html.erb |  45 ++++++---
 .../controllers/collections_controller_test.rb     |  15 +++
 .../test/controllers/users_controller_test.rb      |  11 +++
 .../test/integration/anonymous_access_test.rb      |   1 +
 doc/api/schema/Collection.html.textile.liquid      |  11 +--
 sdk/python/arvados/collection.py                   |   5 +-
 sdk/python/arvados/commands/put.py                 |  22 +++--
 sdk/python/tests/test_arv_put.py                   |   2 +-
 sdk/python/tests/test_arvfile.py                   |  50 +++++-----
 sdk/python/tests/test_collections.py               |  61 +++++++-----
 .../controllers/arvados/v1/schema_controller.rb    |   1 +
 services/api/app/models/collection.rb              |  73 +++++++++------
 services/api/config/application.default.yml        |   6 +-
 ...20150206230342_rename_replication_attributes.rb |  30 ++++++
 services/api/db/structure.sql                      |  15 +--
 services/api/test/fixtures/collections.yml         |  42 +++++++++
 .../arvados/v1/collections_controller_test.rb      |  14 +--
 services/api/test/unit/arvados_model_test.rb       |   2 +-
 services/api/test/unit/collection_test.rb          | 104 ++++++++++++++++++++-
 services/fuse/arvados_fuse/__init__.py             |  12 ++-
 23 files changed, 415 insertions(+), 131 deletions(-)
 create mode 100644 services/api/db/migrate/20150206230342_rename_replication_attributes.rb

       via  50d3be922d18357f1033b02c7add035fba4acd56 (commit)
       via  20b2d6f7560e82add928fa14d868c9a4319d4907 (commit)
       via  d54738ad3b2fde0207cf1ebbdc6f4360cd141d90 (commit)
       via  96e0115f05e1b9fe1dedbe721cbdcb13c29ee875 (commit)
       via  58f8ab40470a8c1db31563e26c66fee9dbdd7477 (commit)
       via  1ee6ce5be0c86c1d2e903252ba2a70694be5cf31 (commit)
       via  c99e40c18e4ba67f529fcd928eed76509dbda130 (commit)
       via  1578bb430ce005137f49233ef87fac34ebc51e2e (commit)
       via  d87717b4ec885059183ef6d7fa6780c343338455 (commit)
       via  daaeb7a23e8a5baf82e3af0f280856862dbc5aa7 (commit)
       via  eff37344f3cecd5aed259c9852aca4bdcdfb6922 (commit)
       via  fd172dd6875c8bf1481c6e078590c0ccef934bca (commit)
       via  5e003c8f9cf47a5bb716dcb75b8e6b98e4680a4c (commit)
       via  f842b72b9e2bb50a68ba388922c55f54ad0399ae (commit)
       via  6ab5505797c96e3aa5652e0d964eec3787e023ac (commit)
       via  8b90f80efca772efd2697ffc70d7809c32564171 (commit)
       via  45d8d010e15b0c4860102b78692ec8bc5b2ef158 (commit)
       via  ef4e4a34213975ed9c1dcd9d4a2efb26f51d027a (commit)
       via  7b877a2be249c5e4ab9ab5d73cb68906ca3113d8 (commit)
       via  11e1ee67236b1dda5dac5e871ecfedd7de8faccf (commit)
       via  1e423bd9887adad61999503771b0794fc62efc28 (commit)
       via  938338a385a96066552aea6230d773a17cbf3c3e (commit)
       via  1f7a6b50cabab4c8645dd6db92e456c080f2a81c (commit)
       via  08c575dc24bbc5732a5fcb1126c23d9a4ca10b73 (commit)
       via  23c1bc62ea3644636c0edce8ccee39f2094db190 (commit)
       via  4106786a571e8d919e474d8ae205c3b2c9042b26 (commit)
       via  cc5699578c16dfb96911b8abcd1b35b8ec0ed7c0 (commit)
       via  d302307a4a66867419722034228823d1fc3910a6 (commit)
       via  d62b73382398808a440f15fdda2eea2e15e44282 (commit)
       via  966bd97704f635315ab7ba50f23590a5fc9a97be (commit)
       via  ec0c0f54da513b2b8221d65d9a2c621a7d95d79e (commit)
       via  353a72e637532f2641e55c79edc0de52e2dd3508 (commit)
      from  503c616f17ec4b77ce1778cc2033e6ed78927f0d (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 50d3be922d18357f1033b02c7add035fba4acd56
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Feb 17 13:36:05 2015 -0500

    4823: Record manifest_text response from API server.  Give better names to
    some tests.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index f6dc4d5..41df555 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -1408,7 +1408,7 @@ class Collection(SynchronizedCollectionBase):
         """
         if self.modified():
             if not self._has_collection_uuid():
-                raise AssertionError("Collection manifest_locator must be a collection uuid.  Use save_as() for new collections.")
+                raise AssertionError("Collection manifest_locator must be a collection uuid.  Use save_new() for new collections.")
             self._my_block_manager().commit_all()
             if merge:
                 self.update()
@@ -1420,7 +1420,7 @@ class Collection(SynchronizedCollectionBase):
                 body={'manifest_text': text}
                 ).execute(
                     num_retries=num_retries)
-            self._manifest_text = text
+            self._manifest_text = self._api_response["manifest_text"]
             self.set_unmodified()
 
     @must_be_writable
@@ -1463,6 +1463,7 @@ class Collection(SynchronizedCollectionBase):
                 body["owner_uuid"] = owner_uuid
 
             self._api_response = self._my_api().collections().create(ensure_unique_name=ensure_unique_name, body=body).execute(num_retries=num_retries)
+            text = self._api_response["manifest_text"]
 
             if self.events:
                 self.events.unsubscribe(filters=[["object_uuid", "=", self._manifest_locator]])
diff --git a/sdk/python/tests/test_arvfile.py b/sdk/python/tests/test_arvfile.py
index aaf79a2..36f14c3 100644
--- a/sdk/python/tests/test_arvfile.py
+++ b/sdk/python/tests/test_arvfile.py
@@ -59,7 +59,8 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_truncate",
                                                  "manifest_text":". 781e5e245d69b566979b86e28d23f2c7+10 0:8:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text":". 781e5e245d69b566979b86e28d23f2c7+10 0:8:count.txt\n"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
                              api_client=api, keep_client=keep) as c:
             writer = c.open("count.txt", "r+")
@@ -76,11 +77,12 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
             self.assertEqual(False, c.modified())
 
-    def test_append0(self):
+    def test_write_to_end(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_append",
                                                  "manifest_text": ". 781e5e245d69b566979b86e28d23f2c7+10 acbd18db4cc2f85cedef654fccc4a4d8+3 0:13:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text": ". 781e5e245d69b566979b86e28d23f2c7+10 acbd18db4cc2f85cedef654fccc4a4d8+3 0:13:count.txt\n"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
                              api_client=api, keep_client=keep) as c:
             writer = c.open("count.txt", "r+")
@@ -106,7 +108,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("foo", keep.get("acbd18db4cc2f85cedef654fccc4a4d8+3"))
 
 
-    def test_append1(self):
+    def test_append(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n', keep_client=keep)
         writer = c.open("count.txt", "a+")
@@ -122,7 +124,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
 
         self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 fc5e038d38a57032085441e7fe7010b0+10 0:20:count.txt\n", export_manifest(c))
 
-    def test_write0(self):
+    def test_write_at_beginning(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
                              keep_client=keep) as c:
@@ -134,7 +136,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("foo3456789", writer.readfrom(0, 13))
             self.assertEqual(". acbd18db4cc2f85cedef654fccc4a4d8+3 781e5e245d69b566979b86e28d23f2c7+10 0:3:count.txt 6:7:count.txt\n", export_manifest(c))
 
-    def test_write1(self):
+    def test_write_in_middle(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
                              keep_client=keep) as c:
@@ -146,7 +148,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("012foo6789", writer.readfrom(0, 13))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 acbd18db4cc2f85cedef654fccc4a4d8+3 0:3:count.txt 10:3:count.txt 6:4:count.txt\n", export_manifest(c))
 
-    def test_write2(self):
+    def test_write_at_end(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
                              keep_client=keep) as c:
@@ -158,7 +160,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("0123456foo", writer.readfrom(0, 13))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 acbd18db4cc2f85cedef654fccc4a4d8+3 0:7:count.txt 10:3:count.txt\n", export_manifest(c))
 
-    def test_write3(self):
+    def test_write_across_segment_boundary(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt 0:10:count.txt\n',
                              keep_client=keep) as c:
@@ -170,7 +172,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("0123456foobar34", writer.readfrom(0, 15))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 3858f62230ac3c915f300c664312c63f+6 0:7:count.txt 10:6:count.txt 3:7:count.txt\n", export_manifest(c))
 
-    def test_write4(self):
+    def test_write_across_several_segments(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:4:count.txt 0:4:count.txt 0:4:count.txt',
                              keep_client=keep) as c:
@@ -186,7 +188,8 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
         keep = ArvadosFileWriterTestCase.MockKeep({})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_write_large",
                                                  "manifest_text": ". a5de24f4417cfba9d5825eadc2f4ca49+67108000 598cc1a4ccaef8ab6e4724d87e675d78+32892000 0:100000000:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text": ". a5de24f4417cfba9d5825eadc2f4ca49+67108000 598cc1a4ccaef8ab6e4724d87e675d78+32892000 0:100000000:count.txt\n"})
         with WritableCollection('. ' + arvados.config.EMPTY_BLOCK_LOCATOR + ' 0:0:count.txt',
                              api_client=api, keep_client=keep) as c:
             writer = c.open("count.txt", "r+")
@@ -201,7 +204,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("zzzzz-4zz18-mockcollection0", c._manifest_locator)
             self.assertEqual(False, c.modified())
 
-    def test_write_rewrite0(self):
+    def test_rewrite_on_empty_file(self):
         keep = ArvadosFileWriterTestCase.MockKeep({})
         with WritableCollection('. ' + arvados.config.EMPTY_BLOCK_LOCATOR + ' 0:0:count.txt',
                              keep_client=keep) as c:
@@ -214,7 +217,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("0123456789", writer.readfrom(0, 20))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n", export_manifest(c))
 
-    def test_write_rewrite1(self):
+    def test_rewrite_append_existing_file(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt',
                              keep_client=keep) as c:
@@ -227,7 +230,7 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("0123456789abcdefghij", writer.readfrom(0, 20))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 a925576942e94b2ef57a066101b48876+10 0:20:count.txt\n", export_manifest(c))
 
-    def test_write_rewrite2(self):
+    def test_rewrite_over_existing_file(self):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt',
                              keep_client=keep) as c:
@@ -240,11 +243,12 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
             self.assertEqual("01234abcdefghij", writer.readfrom(0, 20))
             self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 a925576942e94b2ef57a066101b48876+10 0:5:count.txt 10:10:count.txt\n", export_manifest(c))
 
-    def test_write_large_rewrite0(self):
+    def test_write_large_rewrite(self):
         keep = ArvadosFileWriterTestCase.MockKeep({})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_write_large",
                                                  "manifest_text": ". 37400a68af9abdd76ca5bf13e819e42a+32892003 a5de24f4417cfba9d5825eadc2f4ca49+67108000 32892000:3:count.txt 32892006:67107997:count.txt 0:32892000:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text": ". 37400a68af9abdd76ca5bf13e819e42a+32892003 a5de24f4417cfba9d5825eadc2f4ca49+67108000 32892000:3:count.txt 32892006:67107997:count.txt 0:32892000:count.txt\n"})
         with WritableCollection('. ' + arvados.config.EMPTY_BLOCK_LOCATOR + ' 0:0:count.txt',
                              api_client=api, keep_client=keep) as c:
             writer = c.open("count.txt", "r+")
@@ -265,7 +269,8 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
         keep = ArvadosFileWriterTestCase.MockKeep({})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_create",
                                                  "manifest_text":". 2e9ec317e197819358fbc43afca7d837+8 0:8:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text":". 2e9ec317e197819358fbc43afca7d837+8 0:8:count.txt\n"})
         with WritableCollection(api_client=api, keep_client=keep) as c:
             writer = c.open("count.txt", "w+")
             self.assertEqual(writer.size(), 0)
@@ -285,7 +290,8 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
         keep = ArvadosFileWriterTestCase.MockKeep({})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_create",
                                                  "manifest_text":"./foo/bar 2e9ec317e197819358fbc43afca7d837+8 0:8:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text":"./foo/bar 2e9ec317e197819358fbc43afca7d837+8 0:8:count.txt\n"})
         with WritableCollection(api_client=api, keep_client=keep) as c:
             writer = c.open("foo/bar/count.txt", "w+")
             writer.write("01234567")
@@ -295,7 +301,8 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
         keep = ArvadosFileWriterTestCase.MockKeep({"781e5e245d69b566979b86e28d23f2c7+10": "0123456789"})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_overwrite",
                                                  "manifest_text":". 2e9ec317e197819358fbc43afca7d837+8 0:8:count.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text":". 2e9ec317e197819358fbc43afca7d837+8 0:8:count.txt\n"})
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n',
                              api_client=api, keep_client=keep) as c:
             writer = c.open("count.txt", "w+")
@@ -323,7 +330,8 @@ class ArvadosFileWriterTestCase(unittest.TestCase):
         keep = ArvadosFileWriterTestCase.MockKeep({})
         api = ArvadosFileWriterTestCase.MockApi({"name":"test_create_multiple",
                                                  "manifest_text":". 2e9ec317e197819358fbc43afca7d837+8 e8dc4081b13434b45189a720b77b6818+8 0:8:count1.txt 8:8:count2.txt\n"},
-                                                {"uuid":"zzzzz-4zz18-mockcollection0"})
+                                                {"uuid":"zzzzz-4zz18-mockcollection0",
+                                                 "manifest_text":". 2e9ec317e197819358fbc43afca7d837+8 e8dc4081b13434b45189a720b77b6818+8 0:8:count1.txt 8:8:count2.txt\n"})
         with WritableCollection(api_client=api, keep_client=keep) as c:
             w1 = c.open("count1.txt", "w")
             w2 = c.open("count2.txt", "w")
@@ -406,13 +414,13 @@ class ArvadosFileReaderTestCase(StreamFileReaderTestCase):
         self.assertIn("2e9ec317e197819358fbc43afca7d837+8", keep.requests)
         self.assertIn("e8dc4081b13434b45189a720b77b6818+8", keep.requests)
 
-    def test__eq__1(self):
+    def test__eq__from_manifest(self):
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt') as c1:
             with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt') as c2:
                 self.assertTrue(c1["count1.txt"] == c2["count1.txt"])
                 self.assertFalse(c1["count1.txt"] != c2["count1.txt"])
 
-    def test__eq__2(self):
+    def test__eq__from_writes(self):
         with WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt') as c1:
             with WritableCollection() as c2:
                 with c2.open("count1.txt", "w") as f:
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index a0cdb0d..de06b16 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -857,32 +857,32 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c.remove("foo", recursive=True)
         self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n", export_manifest(c))
 
-    def test_copy_to_dir1(self):
+    def test_copy_to_file_in_dir(self):
         c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c.copy("count1.txt", "foo/count2.txt")
         self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n", export_manifest(c))
 
-    def test_copy_to_dir2(self):
+    def test_copy_file(self):
         c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
+        c.copy("count1.txt", "count2.txt")
+        self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt 0:10:count2.txt\n", c.manifest_text())
+
+    def test_copy_to_existing_dir(self):
+        c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n')
         c.copy("count1.txt", "foo")
-        self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n", export_manifest(c))
+        self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt 0:10:count2.txt\n", export_manifest(c))
 
-    def test_copy_to_dir2(self):
+    def test_copy_to_new_dir(self):
         c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c.copy("count1.txt", "foo/")
         self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n", export_manifest(c))
 
-    def test_copy_file(self):
-        c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
-        c.copy("count1.txt", "count2.txt")
-        self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt 0:10:count2.txt\n", c.manifest_text())
-
     def test_clone(self):
         c = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n')
         cl = c.clone()
         self.assertEqual(". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n", export_manifest(cl))
 
-    def test_diff1(self):
+    def test_diff_del_add(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c2 = WritableCollection('. 5348b82a029fd9e971a811ce1f71360b+43 0:10:count2.txt\n')
         d = c2.diff(c1)
@@ -895,7 +895,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_diff2(self):
+    def test_diff_same(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c2 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         d = c2.diff(c1)
@@ -907,7 +907,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_diff3(self):
+    def test_diff_mod(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c2 = WritableCollection('. 5348b82a029fd9e971a811ce1f71360b+43 0:10:count1.txt\n')
         d = c2.diff(c1)
@@ -919,7 +919,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_diff4(self):
+    def test_diff_add(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c2 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 5348b82a029fd9e971a811ce1f71360b+43 0:10:count1.txt 10:20:count2.txt\n')
         d = c2.diff(c1)
@@ -931,7 +931,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_diff5(self):
+    def test_diff_add_in_subcollection(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c2 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 5348b82a029fd9e971a811ce1f71360b+43 0:10:count2.txt\n')
         d = c2.diff(c1)
@@ -943,7 +943,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_diff6(self):
+    def test_diff_del_add_in_subcollection(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 5348b82a029fd9e971a811ce1f71360b+43 0:10:count2.txt\n')
         c2 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 5348b82a029fd9e971a811ce1f71360b+43 0:3:count3.txt\n')
 
@@ -958,7 +958,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_diff7(self):
+    def test_diff_mod_in_subcollection(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n./foo 5348b82a029fd9e971a811ce1f71360b+43 0:10:count2.txt\n')
         c2 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt 0:3:foo\n')
         d = c2.diff(c1)
@@ -970,7 +970,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), c2.manifest_text())
 
-    def test_conflict1(self):
+    def test_conflict_keep_local_change(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt\n')
         c2 = WritableCollection('. 5348b82a029fd9e971a811ce1f71360b+43 0:10:count2.txt\n')
         d = c1.diff(c2)
@@ -983,7 +983,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         c1.apply(d)
         self.assertEqual(c1.manifest_text(), ". 95ebc3c7b3b9f1d2c40fec14415d3cb8+5 5348b82a029fd9e971a811ce1f71360b+43 0:5:count1.txt 5:10:count2.txt\n")
 
-    def test_conflict2(self):
+    def test_conflict_mod(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt')
         c2 = WritableCollection('. 5348b82a029fd9e971a811ce1f71360b+43 0:10:count1.txt')
         d = c1.diff(c2)
@@ -996,7 +996,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         self.assertTrue(re.match(r"\. 95ebc3c7b3b9f1d2c40fec14415d3cb8\+5 5348b82a029fd9e971a811ce1f71360b\+43 0:5:count1.txt 5:10:count1.txt~conflict-\d\d\d\d-\d\d-\d\d-\d\d:\d\d:\d\d~$",
                                  c1.manifest_text()))
 
-    def test_conflict3(self):
+    def test_conflict_add(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count2.txt\n')
         c2 = WritableCollection('. 5348b82a029fd9e971a811ce1f71360b+43 0:10:count1.txt\n')
         d = c1.diff(c2)
@@ -1010,7 +1010,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         self.assertTrue(re.match(r"\. 95ebc3c7b3b9f1d2c40fec14415d3cb8\+5 5348b82a029fd9e971a811ce1f71360b\+43 0:5:count1.txt 5:10:count1.txt~conflict-\d\d\d\d-\d\d-\d\d-\d\d:\d\d:\d\d~$",
                                  c1.manifest_text()))
 
-    def test_conflict4(self):
+    def test_conflict_del(self):
         c1 = WritableCollection('. 781e5e245d69b566979b86e28d23f2c7+10 0:10:count1.txt')
         c2 = WritableCollection('. 5348b82a029fd9e971a811ce1f71360b+43 0:10:count1.txt')
         d = c1.diff(c2)
@@ -1022,7 +1022,7 @@ class NewCollectionTestCase(unittest.TestCase, CollectionTestMixin):
         self.assertTrue(re.match(r"\. 5348b82a029fd9e971a811ce1f71360b\+43 0:10:count1.txt~conflict-\d\d\d\d-\d\d-\d\d-\d\d:\d\d:\d\d~$",
                                  c1.manifest_text()))
 
-    def test_notify1(self):
+    def test_notify(self):
         c1 = WritableCollection()
         events = []
         c1.subscribe(lambda event, collection, name, item: events.append((event, collection, name, item)))
@@ -1052,9 +1052,24 @@ class CollectionCreateUpdateTest(run_test_server.TestCaseWithServers):
 
         c.save()
 
-        c2 = arvados.api().collections().get(uuid=c._manifest_locator).execute()
         self.assertTrue(re.match(r"^\. 781e5e245d69b566979b86e28d23f2c7\+10\+A[a-f0-9]{40}@[a-f0-9]{8} 0:10:count.txt$",
-                                 c2["manifest_text"]))
+                                 c.manifest_text()))
+
+
+    def test_create_and_save_new(self):
+        c = arvados.collection.createWritableCollection("hello world")
+        self.assertEquals(c.portable_data_hash(), "d41d8cd98f00b204e9800998ecf8427e+0")
+        self.assertEquals(c.api_response()["portable_data_hash"], "d41d8cd98f00b204e9800998ecf8427e+0" )
+
+        with c.open("count.txt", "w") as f:
+            f.write("0123456789")
+
+        self.assertEquals(c.manifest_text(), ". 781e5e245d69b566979b86e28d23f2c7+10 0:10:count.txt\n")
+
+        c.save_new()
+
+        self.assertTrue(re.match(r"^\. 781e5e245d69b566979b86e28d23f2c7\+10\+A[a-f0-9]{40}@[a-f0-9]{8} 0:10:count.txt$",
+                                 c.manifest_text()))
 
     def test_create_diff_apply(self):
         c1 = arvados.collection.createWritableCollection("hello world")

commit 20b2d6f7560e82add928fa14d868c9a4319d4907
Merge: 503c616 d54738a
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue Feb 17 12:16:14 2015 -0500

    Merge branch 'master' into 4823-python-sdk-writable-collection-api

diff --cc services/fuse/arvados_fuse/__init__.py
index 112e48d,71c4ee5..6850de6
--- a/services/fuse/arvados_fuse/__init__.py
+++ b/services/fuse/arvados_fuse/__init__.py
@@@ -30,8 -30,44 +30,10 @@@ _logger = logging.getLogger('arvados.ar
  # appear as underscores in the fuse mount.)
  _disallowed_filename_characters = re.compile('[\x00/]')
  
 -class SafeApi(object):
 -    """Threadsafe wrapper for API object.
 -
 -    This stores and returns a different api object per thread, because
 -    httplib2 which underlies apiclient is not threadsafe.
 -    """
 -
 -    def __init__(self, config):
 -        self.host = config.get('ARVADOS_API_HOST')
 -        self.api_token = config.get('ARVADOS_API_TOKEN')
 -        self.insecure = config.flag_is_true('ARVADOS_API_HOST_INSECURE')
 -        self.local = threading.local()
 -        self.block_cache = arvados.KeepBlockCache()
 -
 -    def localapi(self):
 -        if 'api' not in self.local.__dict__:
 -            self.local.api = arvados.api(
 -                version='v1',
 -                host=self.host, token=self.api_token, insecure=self.insecure)
 -        return self.local.api
 -
 -    def localkeep(self):
 -        if 'keep' not in self.local.__dict__:
 -            self.local.keep = arvados.KeepClient(api_client=self.localapi(), block_cache=self.block_cache)
 -        return self.local.keep
 -
 -    def __getattr__(self, name):
 -        # Proxy nonexistent attributes to the local API client.
 -        try:
 -            return getattr(self.localapi(), name)
 -        except AttributeError:
 -            return super(SafeApi, self).__getattr__(name)
 -
 -
  def convertTime(t):
-     '''Parse Arvados timestamp to unix time.'''
+     """Parse Arvados timestamp to unix time."""
+     if not t:
+         return 0
      try:
          return calendar.timegm(time.strptime(t, "%Y-%m-%dT%H:%M:%SZ"))
      except (TypeError, ValueError):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list