def test_direntry(self):
		h = hashlib.sha1()
		r = archive.archive_read_open_filename(self.a, "dirtest.tar", 10240)
		self.failIf(r != archive.ARCHIVE_OK, "Failed to open dirtest.tar")
		while (archive.archive_read_next_header2(self.a, self.ae) == archive.ARCHIVE_OK):
			name = archive.archive_entry_pathname(self.ae)
			if name == 'a/' or name == 'a/b/':
				type = archive.AE_IFDIR
			elif name == 'a/c':
				type = archive.AE_IFREG
			else:
				self.fail("Unknown filename %s" %(name))
			ft = archive.myemsl_archive_entry_filetype(self.ae)
			archive.archive_read_data_skip(self.a)
			self.failIf(ft != type, "Wrong type.")
 def test_direntry(self):
     h = hashlib.sha1()
     r = archive.archive_read_open_filename(self.a, "dirtest.tar", 10240)
     self.failIf(r != archive.ARCHIVE_OK, "Failed to open dirtest.tar")
     while (archive.archive_read_next_header2(
             self.a, self.ae) == archive.ARCHIVE_OK):
         name = archive.archive_entry_pathname(self.ae)
         if name == 'a/' or name == 'a/b/':
             type = archive.AE_IFDIR
         elif name == 'a/c':
             type = archive.AE_IFREG
         else:
             self.fail("Unknown filename %s" % (name))
         ft = archive.myemsl_archive_entry_filetype(self.ae)
         archive.archive_read_data_skip(self.a)
         self.failIf(ft != type, "Wrong type.")
	def test_skip(self):
		h = hashlib.sha1()
		r = archive.archive_read_open_filename(self.a, "testdata2.tar", 10240)
		self.failIf(r != archive.ARCHIVE_OK, "Failed to open testdata2.tar")
		while (archive.archive_read_next_header2(self.a, self.ae) == archive.ARCHIVE_OK):
			name = archive.archive_entry_pathname(self.ae)
			if name != 'testdata':
				archive.archive_read_data_skip(self.a)
				continue
			(e, d) = archive.myemsl_archive_read_data(self.a, 10240)
			self.failIf(e != 0, "Failure during data read %s" %(e))
			while(len(d) > 0):
				h.update(d)
				(e, d) = archive.myemsl_archive_read_data(self.a, 10240)
				self.failIf(e != 0, "Failure during data read %s" %(e))
			file_hash = h.hexdigest()
			sha1 = '51c15743ad61d2ceb55a05efb073d73fc9a759cb'
			self.failIf(file_hash != sha1, "Data verify failed. Sha1 sums don't match. %s != %s" %(file_hash, sha1))
 def test_skip(self):
     h = hashlib.sha1()
     r = archive.archive_read_open_filename(self.a, "testdata2.tar", 10240)
     self.failIf(r != archive.ARCHIVE_OK, "Failed to open testdata2.tar")
     while (archive.archive_read_next_header2(
             self.a, self.ae) == archive.ARCHIVE_OK):
         name = archive.archive_entry_pathname(self.ae)
         if name != 'testdata':
             archive.archive_read_data_skip(self.a)
             continue
         (e, d) = archive.myemsl_archive_read_data(self.a, 10240)
         self.failIf(e != 0, "Failure during data read %s" % (e))
         while (len(d) > 0):
             h.update(d)
             (e, d) = archive.myemsl_archive_read_data(self.a, 10240)
             self.failIf(e != 0, "Failure during data read %s" % (e))
         file_hash = h.hexdigest()
         sha1 = '51c15743ad61d2ceb55a05efb073d73fc9a759cb'
         self.failIf(
             file_hash != sha1,
             "Data verify failed. Sha1 sums don't match. %s != %s" %
             (file_hash, sha1))