def verify_dir(): # test2: test that a packed dir gets unpacked correctly tweet_id = pack(TEST_SRC, memory_uploader) root_payload = deserialize(memory_downloader(tweet_id)) unpack(root_payload, memory_downloader, name_override=TEST_DIR_DEST, recur=True) if not are_identical_dirs(TEST_SRC, TEST_DIR_DEST): raise RuntimeError('%s is diff than %s, packing test failed' % \ (TEST_SRC, TEST_DIR_DEST)) else: print 'TEST 2: PASSED'
def verify_file(): # test1: test that a packed file gets unpacked correctly fn = TEST_SRC + '/foo' tweet_id = pack(fn, memory_uploader) payload = deserialize(memory_downloader(tweet_id)) unpack(payload, memory_downloader, name_override=TEST_FILE_DEST , recur=True) if not are_identical_dirs(fn, TEST_FILE_DEST): raise RuntimeError('%s is diff than %s, packing test failed' % \ (fn, TEST_FILE_DEST)) else: print 'TEST 1: PASSED'
def download(tweet_id, downloader, concealer, name_override=False): print 'mode: download' l = downloader(tweet_id) l = [x.encode('ascii', 'ignore').decode('string_escape') for x in l] root = deserialize(concealer.reveal(l)) #.tobytes()) unpack(root, tweet_id, downloader, concealer, name_override=name_override, recur=True) print 'done'
def verify_file(): # test1: test that a packed file gets unpacked correctly fn = TEST_SRC + '/foo' tweet_id = pack(fn, memory_uploader) payload = deserialize(memory_downloader(tweet_id)) unpack(payload, memory_downloader, name_override=TEST_FILE_DEST, recur=True) if not are_identical_dirs(fn, TEST_FILE_DEST): raise RuntimeError('%s is diff than %s, packing test failed' % \ (fn, TEST_FILE_DEST)) else: print 'TEST 1: PASSED'
def download(tweet_id, downloader, concealer, name_override=False): print 'mode: download' root = deserialize(concealer.reveal(downloader(tweet_id)))#.tobytes()) unpack(root, tweet_id, downloader, concealer, name_override=name_override, recur=True) print 'done'