Back to index

plone3  3.1.7
Classes | Functions | Variables
Archetypes.tests.test_metadata Namespace Reference

Classes

class  DummyPortalMembership
class  DummyFolder
class  ExtensibleMetadataTest
class  ExtMetadataContextTest
class  ExtMetadataDefaultLanguageTest
class  ExtMetadataSetFormatTest
class  TimeZoneTest

Functions

def addMetadataTo
def compareMetadataOf
def test_suite

Variables

list fieldList

Function Documentation

def Archetypes.tests.test_metadata.addMetadataTo (   obj,
  data = 'default',
  mimetype = 'application/octet-stream',
  time = 1000 
)

Definition at line 72 of file test_metadata.py.

00072 
00073 def addMetadataTo(obj, data='default', mimetype='application/octet-stream', time=1000):
00074     """ """
00075     obj.setTitle(data)
00076     obj.setSubject([data])
00077     obj.setDescription(data)
00078     obj.setContributors([data])
00079     obj.setEffectiveDate(DateTime(time, 0))
00080     obj.setExpirationDate(DateTime(time, 0))
00081     obj.setFormat(mimetype)
00082     obj.setLanguage(data)
00083     obj.setRights(data)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.tests.test_metadata.compareMetadataOf (   test,
  obj,
  data = 'default',
  mimetype = 'application/octet-stream',
  time = 1000 
)

Definition at line 85 of file test_metadata.py.

00085 
00086                       mimetype='application/octet-stream', time=1000):
00087     l_data = (data,)
00088     test.failUnless(obj.Title() == data, 'Title')
00089     test.failUnless(obj.Subject() == l_data,
00090                     'Subject: %s, %s' % (obj.Subject(), l_data))
00091     test.failUnless(obj.Description() == data, 'Description')
00092     test.failUnless(obj.Contributors() == l_data, 'Contributors')
00093     test.failUnless(obj.EffectiveDate() == DateTime(time, 0).ISO(),
00094                     'effective date')
00095     test.failUnless(obj.ExpirationDate() == DateTime(time, 0).ISO(),
00096                     'expiration date')
00097     if aq_base(obj) is obj:
00098         # If the object is not acquisition wrapped, then those
00099         # ComputedAttributes won't get executed because the
00100         # declaration requires it to be wrapped
00101         # like: ComputedAttribute(method, 1)
00102         test.failUnless(isinstance(obj.effective_date, ComputedAttribute))
00103         test.failUnless(isinstance(obj.expiration_date, ComputedAttribute))
00104     else:
00105         test.failUnlessEqual(str(obj.effective_date),  str(DateTime(time, 0)))
00106         test.failUnlessEqual(str(obj.expiration_date), str(DateTime(time, 0)))
00107     # XXX BROKEN! test.failUnless(obj.Format() == data,
00108     #                             'Format: %s, %s' % (obj.Format(), mimetype))
00109     test.failUnless(obj.Language() == data, 'Language')
00110     test.failUnless(obj.Rights() == data, 'Rights')
00111 

Here is the caller graph for this function:

Definition at line 392 of file test_metadata.py.

00392 
00393 def test_suite():
00394     from unittest import TestSuite, makeSuite
00395     suite = TestSuite()
00396     suite.addTest(makeSuite(ExtensibleMetadataTest))
00397     suite.addTest(makeSuite(ExtMetadataContextTest))
00398     suite.addTest(makeSuite(ExtMetadataDefaultLanguageTest))
00399     suite.addTest(makeSuite(ExtMetadataSetFormatTest))
00400     suite.addTest(makeSuite(TimeZoneTest))
00401     return suite

Variable Documentation

Initial value:
00001 [
00002     # (accessor, mutator, field),
00003     ('Title', 'setTitle',                    ''),
00004     ('Creator', '',                          ''),
00005     ('Subject','setSubject',                 'subject'),
00006     ('Description','setDescription',         'description'),
00007     ('Publisher', '',                        ''),
00008     ('Contributors','setContributors',       'contributors'),
00009     ('Date', '',                             ''),
00010     ('CreationDate', '',                     ''),
00011     ('EffectiveDate','setEffectiveDate',     'effectiveDate'),
00012     ('ExpirationDate','setExpirationDate',   'expirationDate'),
00013     ('ModificationDate', '',                 ''),
00014     ('Type', '',                             ''),
00015     ('Format', 'setFormat',                  ''),
00016     ('Identifier', '',                       ''),
00017     ('Language','setLanguage',               'language'),
00018     ('Rights','setRights',                   'rights'),
00019 
00020     # allowDiscussion is not part of the official DC metadata set
00021     ('allowDiscussion','isDiscussable','allowDiscussion'),
00022   ]

Definition at line 45 of file test_metadata.py.