3 # ARVADOS_API_TOKEN=abc ARVADOS_API_HOST=arvados.local python -m unittest discover
9 class KeepTestCase(unittest.TestCase):
12 del os.environ['KEEP_LOCAL_STORE']
16 class KeepBasicRWTest(KeepTestCase):
18 foo_locator = arvados.Keep.put('foo')
19 self.assertEqual(foo_locator,
20 'acbd18db4cc2f85cedef654fccc4a4d8+3',
21 'wrong md5 hash from Keep.put("foo"): ' + foo_locator)
22 self.assertEqual(arvados.Keep.get(foo_locator),
24 'wrong content from Keep.get(md5("foo"))')
26 class KeepBinaryRWTest(KeepTestCase):
28 blob_str = '\xff\xfe\xf7\x00\x01\x02'
29 blob_locator = arvados.Keep.put(blob_str)
30 self.assertEqual(blob_locator,
31 '7fc7c53b45e53926ba52821140fef396+6',
32 ('wrong locator from Keep.put(<binarydata>):' +
34 self.assertEqual(arvados.Keep.get(blob_locator),
36 'wrong content from Keep.get(md5(<binarydata>))')
38 class KeepLongBinaryRWTest(KeepTestCase):
40 blob_str = '\xff\xfe\xfd\xfc\x00\x01\x02\x03'
42 blob_str = blob_str + blob_str
43 blob_locator = arvados.Keep.put(blob_str)
44 self.assertEqual(blob_locator,
45 '84d90fc0d8175dd5dcfab04b999bc956+67108864',
46 ('wrong locator from Keep.put(<binarydata>): ' +
48 self.assertEqual(arvados.Keep.get(blob_locator),
50 'wrong content from Keep.get(md5(<binarydata>))')
52 class KeepSingleCopyRWTest(KeepTestCase):
54 blob_str = '\xff\xfe\xfd\xfc\x00\x01\x02\x03'
55 blob_locator = arvados.Keep.put(blob_str, copies=1)
56 self.assertEqual(blob_locator,
57 'c902006bc98a3eb4a3663b65ab4a6fab+8',
58 ('wrong locator from Keep.put(<binarydata>): ' +
60 self.assertEqual(arvados.Keep.get(blob_locator),
62 'wrong content from Keep.get(md5(<binarydata>))')