Back to index

enigmail  1.4.3
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions
unitMozZipFile.TestExtensiveStored Class Reference
Inheritance diagram for unitMozZipFile.TestExtensiveStored:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def leaf
def setUp
def tearDown

Public Attributes

 f
 ref
 seed

Static Public Attributes

string stage = "mozzipfilestage"
 compression = zipfile.ZIP_STORED

Private Member Functions

def _verifyZip
def _write

Detailed Description

Unit tests for MozZipFile

The testcase are actually populated by code following the class
definition.

Definition at line 142 of file unitMozZipFile.py.


Member Function Documentation

Definition at line 166 of file unitMozZipFile.py.

00166 
00167   def _verifyZip(self):
00168     zf = zipfile.ZipFile(self.f)
00169     badEntry = zf.testzip()
00170     self.failIf(badEntry, badEntry)
00171     zlist = zf.namelist()
00172     zlist.sort()
00173     vlist = self.ref.keys()
00174     vlist.sort()
00175     self.assertEqual(zlist, vlist)
00176     for leaf, content in self.ref.iteritems():
00177       zcontent = zf.read(leaf)
00178       self.assertEqual(content, zcontent)
  

Here is the call graph for this function:

def unitMozZipFile.TestExtensiveStored._write (   self,
  zf,
  seed = None,
  leaf = 0,
  length = 0 
) [private]

Definition at line 179 of file unitMozZipFile.py.

00179 
00180   def _write(self, zf, seed=None, leaf=0, length=0):
00181     if seed is None:
00182       seed = self.seed
00183       self.seed += 1
00184     random.seed(seed)
00185     leaf = leafs[leaf]
00186     content = getContent(length)
00187     self.ref[leaf] = content
00188     zf.writestr(leaf, content)
00189     dir = os.path.dirname(self.leaf('stage', leaf))
00190     if not os.path.isdir(dir):
00191       os.makedirs(dir)
00192     open(self.leaf('stage', leaf), 'w').write(content)
00193 
# all leafs in all lengths

Here is the call graph for this function:

def unitMozZipFile.TestExtensiveStored.leaf (   self,
  leafs 
)

Definition at line 152 of file unitMozZipFile.py.

00152 
00153   def leaf(self, *leafs):
    return os.path.join(self.stage, *leafs)

Here is the caller graph for this function:

Definition at line 154 of file unitMozZipFile.py.

00154 
00155   def setUp(self):
00156     if os.path.exists(self.stage):
00157       shutil.rmtree(self.stage)
00158     os.mkdir(self.stage)
00159     self.f = self.leaf('test.jar')
00160     self.ref = {}
00161     self.seed = 0
  

Definition at line 162 of file unitMozZipFile.py.

00162 
00163   def tearDown(self):
00164     self.f = None
00165     self.ref = None
  

Member Data Documentation

unitMozZipFile.TestExtensiveStored.compression = zipfile.ZIP_STORED [static]

Reimplemented in unitMozZipFile.TestExtensiveDeflated.

Definition at line 150 of file unitMozZipFile.py.

Definition at line 158 of file unitMozZipFile.py.

Definition at line 159 of file unitMozZipFile.py.

Definition at line 160 of file unitMozZipFile.py.

string unitMozZipFile.TestExtensiveStored.stage = "mozzipfilestage" [static]

Definition at line 149 of file unitMozZipFile.py.


The documentation for this class was generated from the following file: