コード例 #1
0
 def testRead(self):
     mc = Session((StorageServiceTest.addr, StorageServiceTest.port), None)
     mc.start()
     service = StorageService(mc)
     self.assertEqual(
         service.read(u"{}_A1".format(StorageServiceTest.testSpacePath), 1,
                      10), b"234567890a")
     self.assertEqual(
         service.read(u"{}_A1".format(StorageServiceTest.testSpacePath), 30,
                      6), b"uvwxyz")
     self.assertEqual(
         service.readAll(u"{}_A2".format(StorageServiceTest.testSpacePath)),
         b'0123456789')
     mc.stop()
コード例 #2
0
 def testAppend(self):
     mc = Session((StorageServiceTest.addr, StorageServiceTest.port), None)
     mc.start()
     service = StorageService(mc)
     service.append(u"{}_A1".format(StorageServiceTest.testSpacePath),
                    b"ABCDE")
     self.assertEqual(
         service.metaData(u"{}_A1".format(
             StorageServiceTest.testSpacePath)), {
                 u"Name": u"_A1",
                 u"Path": u"{}_A1".format(StorageServiceTest.testSpacePath),
                 u"Type": u"Content",
                 u"Size": 41
             })
     self.assertEqual(
         service.read(u"{}_A1".format(StorageServiceTest.testSpacePath), 35,
                      6), b"zABCDE")
     mc.stop()