3 # ARVADOS_API_TOKEN=abc ARVADOS_API_HOST=arvados.local python -m unittest discover
10 class KeepTestCase(unittest.TestCase):
14 del os.environ['KEEP_LOCAL_STORE']
18 run_test_server.run_keep()
21 def tearDownClass(cls):
22 run_test_server.stop()
23 run_test_server.stop_keep()
25 def test_KeepBasicRWTest(self):
26 foo_locator = arvados.Keep.put('foo')
27 self.assertEqual(foo_locator,
28 'acbd18db4cc2f85cedef654fccc4a4d8+3',
29 'wrong md5 hash from Keep.put("foo"): ' + foo_locator)
30 self.assertEqual(arvados.Keep.get(foo_locator),
32 'wrong content from Keep.get(md5("foo"))')
34 def test_KeepBinaryRWTest(self):
35 blob_str = '\xff\xfe\xf7\x00\x01\x02'
36 blob_locator = arvados.Keep.put(blob_str)
37 self.assertEqual(blob_locator,
38 '7fc7c53b45e53926ba52821140fef396+6',
39 ('wrong locator from Keep.put(<binarydata>):' +
41 self.assertEqual(arvados.Keep.get(blob_locator),
43 'wrong content from Keep.get(md5(<binarydata>))')
45 def test_KeepLongBinaryRWTest(self):
46 blob_str = '\xff\xfe\xfd\xfc\x00\x01\x02\x03'
48 blob_str = blob_str + blob_str
49 blob_locator = arvados.Keep.put(blob_str)
50 self.assertEqual(blob_locator,
51 '84d90fc0d8175dd5dcfab04b999bc956+67108864',
52 ('wrong locator from Keep.put(<binarydata>): ' +
54 self.assertEqual(arvados.Keep.get(blob_locator),
56 'wrong content from Keep.get(md5(<binarydata>))')
58 def test_KeepSingleCopyRWTest(self):
59 blob_str = '\xff\xfe\xfd\xfc\x00\x01\x02\x03'
60 blob_locator = arvados.Keep.put(blob_str, copies=1)
61 self.assertEqual(blob_locator,
62 'c902006bc98a3eb4a3663b65ab4a6fab+8',
63 ('wrong locator from Keep.put(<binarydata>): ' +
65 self.assertEqual(arvados.Keep.get(blob_locator),
67 'wrong content from Keep.get(md5(<binarydata>))')