def testDesrialize(self): badInfohash = str2bin("GEh/o8rtTLB1wZJzFcSZSS4u9qo=") dto = MetadataDTO(test_perm_id, badInfohash) dto.description = u"Sample Description" dto.sign(test_keypair) serialized = dto.serialize() newDto = MDUtil.deserialize(serialized) self.assertEquals(dto, newDto)
def testDeserializeWithSubs(self): badInfohash = str2bin("GEh/o8rtTLB1wZJzFcSZSS4u9qo=") dto = MetadataDTO(test_perm_id, badInfohash) subtitles = [SubtitleInfo(lang, path) for lang, path in self._srtSubs.iteritems()] for sub in subtitles: sub.computeChecksum() dto.addSubtitle(sub) dto.sign(test_keypair) serial = dto.serialize() newDto = MDUtil.deserialize(serial) self.assertEquals(dto, newDto)
def testDeserializeWithSubs(self): badInfohash = str2bin("GEh/o8rtTLB1wZJzFcSZSS4u9qo=") dto = MetadataDTO(test_perm_id, badInfohash) subtitles = [ SubtitleInfo(lang, path) for lang, path in self._srtSubs.iteritems() ] for sub in subtitles: sub.computeChecksum() dto.addSubtitle(sub) dto.sign(test_keypair) serial = dto.serialize() newDto = MDUtil.deserialize(serial) self.assertEquals(dto, newDto)