Example #1
0
 def test13_mime_type(self):
     r = Resource(uri='tv1', mime_type='text/plain')
     self.assertEqual( r.mime_type, 'text/plain' )
     r.mime_type = None
     self.assertEqual( r.mime_type, None )
     r = Resource(uri='tv2')
     self.assertEqual( r.mime_type, None )
Example #2
0
 def test1c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource("a")
     r1lm = "2012-01-01T00:00:00Z"
     r1.lastmod = r1lm
     r2 = Resource("a")
     for r2lm in (
         "2012",
         "2012-01",
         "2012-01-01",
         "2012-01-01T00:00Z",
         "2012-01-01T00:00:00Z",
         "2012-01-01T00:00:00.000000Z",
         "2012-01-01T00:00:00.000000000000Z",
         "2012-01-01T00:00:00.000000000001Z",  # below resolution
         "2012-01-01T00:00:00.00+00:00",
         "2012-01-01T00:00:00.00-00:00",
         "2012-01-01T02:00:00.00-02:00",
         "2011-12-31T23:00:00.00+01:00",
     ):
         r2.lastmod = r2lm
         self.assertEqual(
             r1.timestamp, r2.timestamp, ("%s (%f) == %s (%f)" % (r1lm, r1.timestamp, r2lm, r2.timestamp))
         )
         self.assertEqual(r1, r2)
Example #3
0
 def test_01_resource_str(self):
     r1 = Resource("a3")
     r1.lastmod = "2012-01-11T01:02:03"
     self.assertEqual(
         Sitemap().resource_as_xml(r1),
         "<?xml version='1.0' encoding='UTF-8'?>\n<url><loc>a3</loc><lastmod>2012-01-11T01:02:03</lastmod></url>",
     )
Example #4
0
 def test01d_same(self):
     """Same with slight timestamp diff"""
     r1 = Resource('a')
     r1.lastmod='2012-01-02T01:02:03Z'
     r2 = Resource('a')
     r2.lastmod='2012-01-02T01:02:03.99Z'
     self.assertNotEqual( r1.timestamp, r2.timestamp )
     self.assertEqual( r1, r2 )
Example #5
0
 def test1d_same(self):
     """Same with slight timestamp diff"""
     r1 = Resource("a")
     r1.lastmod = "2012-01-02T01:02:03Z"
     r2 = Resource("a")
     r2.lastmod = "2012-01-02T01:02:03.99Z"
     self.assertNotEqual(r1.timestamp, r2.timestamp)
     self.assertEqual(r1, r2)
Example #6
0
 def test_03_resource_str_hashes(self):
     r1 = Resource('03hashes',1234.1)
     r1.md5 = 'aaa'
     r1.sha1 = 'bbb'
     self.assertEqual( Sitemap().resource_as_xml(r1), "<url><loc>03hashes</loc><lastmod>1970-01-01T00:20:34.100000Z</lastmod><rs:md hash=\"md5:aaa sha-1:bbb\" /></url>" )
     r1.sha256 = 'ccc'
     self.assertEqual( Sitemap().resource_as_xml(r1), "<url><loc>03hashes</loc><lastmod>1970-01-01T00:20:34.100000Z</lastmod><rs:md hash=\"md5:aaa sha-1:bbb sha-256:ccc\" /></url>" )
     r1.sha1 = None
     self.assertEqual( Sitemap().resource_as_xml(r1), "<url><loc>03hashes</loc><lastmod>1970-01-01T00:20:34.100000Z</lastmod><rs:md hash=\"md5:aaa sha-256:ccc\" /></url>" )
Example #7
0
 def test10_md_at_roundtrips(self):
     r = Resource('a')
     r.md_at='2013-03-14'
     self.assertEqual( r.md_at, '2013-03-14T00:00:00Z' )
     r.md_at='2013-03-14T00:00:00+00:00'
     self.assertEqual( r.md_at, '2013-03-14T00:00:00Z' )
     r.md_at='2013-03-14T00:00:00-00:00'
     self.assertEqual( r.md_at, '2013-03-14T00:00:00Z' )
     r.md_at='2013-03-14T18:37:36Z'
     self.assertEqual( r.md_at, '2013-03-14T18:37:36Z' )
Example #8
0
 def test11_md_completed_roundtrips(self):
     r = Resource('a')
     r.md_completed='2013-04-14'
     self.assertEqual( r.md_completed, '2013-04-14T00:00:00Z' )
     r.md_completed='2013-04-14T00:00:00+00:00'
     self.assertEqual( r.md_completed, '2013-04-14T00:00:00Z' )
     r.md_completed='2013-04-14T00:00:00-00:00'
     self.assertEqual( r.md_completed, '2013-04-14T00:00:00Z' )
     r.md_completed='2013-04-14T18:37:36Z'
     self.assertEqual( r.md_completed, '2013-04-14T18:37:36Z' )
Example #9
0
 def test6_has_md5(self):
     r1 = Resource(uri="a")
     r2 = Resource(uri="b")
     m = Inventory()
     self.assertFalse(m.has_md5())
     m.add(r1)
     m.add(r2)
     self.assertFalse(m.has_md5())
     r1.md5 = "aabbcc"
     self.assertTrue(m.has_md5())
Example #10
0
 def test09_changetypeerror(self):
     r1 = Resource('a')
     self.assertEqual( r1.change, None )
     r1.change = 'deleted'
     self.assertEqual( r1.change, 'deleted' )
     self.assertRaises( ChangeTypeError, Resource, 'a', change="bad" )
     # disable checking
     Resource.CHANGE_TYPES = False
     r1 = Resource( 'a', change="bad" )
     self.assertEqual( r1.change, 'bad' )
Example #11
0
 def test6_has_md5(self):
     r1 = Resource(uri='a')
     r2 = Resource(uri='b')
     i = ResourceList()
     self.assertFalse( i.has_md5() )
     i.add(r1)
     i.add(r2)
     self.assertFalse( i.has_md5() )
     r1.md5="aabbcc"
     self.assertTrue( i.has_md5() )
Example #12
0
 def test_build_ex_17(self):
     """Resource Dump with 3 entries and some metadata"""
     rd = ResourceDump()
     rd.up='http://example.com/dataset1/capabilitylist.xml'
     rd.md_at="2013-01-03T09:00:00Z"
     rd.md_completed="2013-01-03T09:04:00Z"
     z1 = Resource( uri='http://example.com/resourcedump-part1.zip',
                    mime_type="application/zip",
                    length=4765,
                    md_at="2013-01-03T09:00:00Z",
                    md_completed="2013-01-03T09:02:00Z" )
     z1.link_set( rel="contents",
                  href="http://example.com/resourcedump_manifest-part1.xml",
                  mime_type="application/xml" )
     rd.add( z1 )
     z2 = Resource( uri='http://example.com/resourcedump-part2.zip',
                    mime_type="application/zip",
                    length=9875,
                    md_at="2013-01-03T09:01:00Z",
                    md_completed="2013-01-03T09:03:00Z" )
     z2.link_set( rel="contents",
                  href="http://example.com/resourcedump_manifest-part2.xml",
                  mime_type="application/xml" )
     rd.add( z2 )
     z3 = Resource( uri='http://example.com/resourcedump-part3.zip',
                    mime_type="application/zip",
                    length=2298,
                    md_at="2013-01-03T09:03:00Z",
                    md_completed="2013-01-03T09:04:00Z" )
     z3.link_set( rel="contents",
                  href="http://example.com/resourcedump_manifest-part3.xml",
                  mime_type="application/xml" )
     rd.add( z3 )
     ex_xml = self._open_ex('resourcesync_ex_17').read()
     self._assert_xml_equal( rd.as_xml(), ex_xml )
Example #13
0
 def test_build_ex_07(self):
     """A Source Description document """
     sd = SourceDescription()
     sd.describedby = 'http://example.com/info-about-source.xml'
     r = Resource( uri='http://example.com/dataset1/capabilitylist.xml',
                   capability='capabilitylist' )
     r.link_set( rel='describedby',
                 href='http://example.com/info_about_set1_of_resources.xml' )
     sd.add( r )
     ex_xml = self._open_ex('resourcesync_ex_7').read()
     self._assert_xml_equal( sd.as_xml(), ex_xml )
Example #14
0
 def test_04_resource_str(self):
     r1 = Resource(uri='4a',lastmod="2013-01-02",length=9999,md5='ab54de')
     r1.ln = [{ 'rel':'duplicate',
                'pri':'1',
                'href':'http://mirror1.example.com/res1',
                'modified':'2013-01-02T18:00:00Z' }]
     self.assertEqual( Sitemap().resource_as_xml(r1), "<url><loc>4a</loc><lastmod>2013-01-02T00:00:00Z</lastmod><rs:md hash=\"md5:ab54de\" length=\"9999\" /><rs:ln href=\"http://mirror1.example.com/res1\" modified=\"2013-01-02T18:00:00Z\" pri=\"1\" rel=\"duplicate\" /></url>" )
     # add another two rs:ln's
     r1.ln.append( { 'rel':'num2' } )
     r1.ln.append( { 'rel':'num3' } )
     self.assertEqual( Sitemap().resource_as_xml(r1), "<url><loc>4a</loc><lastmod>2013-01-02T00:00:00Z</lastmod><rs:md hash=\"md5:ab54de\" length=\"9999\" /><rs:ln href=\"http://mirror1.example.com/res1\" modified=\"2013-01-02T18:00:00Z\" pri=\"1\" rel=\"duplicate\" /><rs:ln rel=\"num2\" /><rs:ln rel=\"num3\" /></url>" )
Example #15
0
 def test07_hashes(self):
     r1 = Resource(uri='a')
     r2 = Resource(uri='b')
     i = ResourceList()
     self.assertEqual(i.hashes(), set())
     i.add(r1)
     i.add(r2)
     self.assertEqual(i.hashes(), set())
     r1.md5 = "aabbcc"
     self.assertEqual(i.hashes(), set(['md5']))
     r2.sha1 = "ddeeff"
     self.assertEqual(i.hashes(), set(['md5', 'sha-1']))
Example #16
0
 def test05_lastmod_roundtrips(self):
     r = Resource('a')
     r.lastmod='2012-03-14'
     self.assertEqual( r.lastmod, '2012-03-14T00:00:00Z' )
     r.lastmod='2012-03-14T00:00:00+00:00'
     #print r.timestamp
     self.assertEqual( r.lastmod, '2012-03-14T00:00:00Z' )
     r.lastmod='2012-03-14T00:00:00-00:00'
     #print r.timestamp
     self.assertEqual( r.lastmod, '2012-03-14T00:00:00Z' )
     r.lastmod='2012-03-14T18:37:36Z'
     #print r.timestamp
     self.assertEqual( r.lastmod, '2012-03-14T18:37:36Z' )
Example #17
0
 def test5_lastmod_roundtrips(self):
     r = Resource("a")
     r.lastmod = "2012-03-14"
     self.assertEqual(r.lastmod, "2012-03-14T00:00:00Z")
     r.lastmod = "2012-03-14T00:00:00+00:00"
     print r.timestamp
     self.assertEqual(r.lastmod, "2012-03-14T00:00:00Z")
     r.lastmod = "2012-03-14T00:00:00-00:00"
     print r.timestamp
     self.assertEqual(r.lastmod, "2012-03-14T00:00:00Z")
     r.lastmod = "2012-03-14T18:37:36Z"
     print r.timestamp
     self.assertEqual(r.lastmod, "2012-03-14T18:37:36Z")
Example #18
0
 def test_build_ex_26(self):
     cl = ChangeList()
     cl.up = "http://example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T00:00:00Z"
     c1 = Resource(uri="http://example.com/res1.html",
                   lastmod="2013-01-03T18:00:00Z",
                   change="updated",
                   md5="1584abdf8ebdc9802ac0c6a7402c03b6",
                   length=8876 )
     c1.link_add(rel="canonical",
                 href="http://example.com/res1",
                 modified="2013-01-03T18:00:00Z")
     cl.add( c1 )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_26' )
Example #19
0
 def test_build_ex_30(self):
     cl = ChangeList()
     cl.up = "http://example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T00:00:00Z"
     c1 = Resource(uri="http://example.com/res1",
                   lastmod="2013-01-03T07:00:00Z",
                   change="updated",
                   md5="1584abdf8ebdc9802ac0c6a7402c03b6",
                   length=8876,
                   mime_type="text/html" )
     c1.link_add(rel="collection",
                 href="http://example.com/aggregation/0601007")
     cl.add( c1 )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_30' )
Example #20
0
 def test_build_ex_02(self):
     """Slightly more complex Resource List document """
     rl = ResourceList()
     rl.md_at = '2013-01-03T09:00:00Z'
     rl.add( Resource(uri='http://example.com/res1',
                      lastmod='2013-01-02T13:00:00Z',
                      md5='1584abdf8ebdc9802ac0c6a7402c03b6') )
     r2 =  Resource(uri='http://example.com/res2',
                    lastmod='2013-01-02T14:00:00Z',
                    md5='1e0d5cb8ef6ba40c99b14c0237be735e')
     r2.link_set(rel="duplicate",href="http://mirror.example.com/res2")
     rl.add( r2 )
     ex_xml = self._open_ex('resourcesync_ex_2').read()
     self._assert_xml_equal( rl.as_xml(), ex_xml )
Example #21
0
 def test_build_ex_28(self):
     cl = ChangeList()
     cl.up = "http://example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T00:00:00Z"
     c1 = Resource(uri="http://example.com/res2.pdf",
                   lastmod="2013-01-03T18:00:00Z",
                   change="updated",
                   md5="1584abdf8ebdc9802ac0c6a7402c03b6",
                   length=8876,
                   mime_type="application/pdf" )
     c1.link_set(rel="describedby",
                 href="http://example.com/res2_dublin-core_metadata.xml",
                 modified="2013-01-01T12:00:00Z",
                 type="application/xml")
     c2 = Resource(uri="http://example.com/res2_dublin-core_metadata.xml",
                   lastmod="2013-01-03T19:00:00Z",
                   change="updated",
                   mime_type="application/xml")
     c2.link_set(rel="describes",
                 href="http://example.com/res2.pdf",
                 modified="2013-01-03T18:00:00Z",
                 hash="md5:1584abdf8ebdc9802ac0c6a7402c03b6",
                 length="8876",
                 type="application/pdf")
     c2.link_set(rel="profile",
                 href="http://purl.org/dc/elements/1.1/")
     cl.add( [c1,c2] )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_28' )
Example #22
0
 def test19_delete_resource(self):
     c = Client()
     resource = Resource(uri='http://example.org/1')
     filename = os.path.join(self.tmpdir, 'resource1')
     c.last_timestamp = 5
     # no delete, no timestamp update
     with LogCapture() as lc:
         c.logger = logging.getLogger('resync.client')
         n = c.delete_resource(resource, filename)
         self.assertEqual(n, 0)
         self.assertEqual(lc.records[-1].msg,
                          'nodelete: would delete http://example.org/1 (--delete to enable)')
         self.assertEqual(c.last_timestamp, 5)
     # no delete but timestamp update
     resource.timestamp = 10
     with LogCapture() as lc:
         c.logger = logging.getLogger('resync.client')
         n = c.delete_resource(resource, filename)
         self.assertEqual(n, 0)
         self.assertEqual(lc.records[-1].msg,
                          'nodelete: would delete http://example.org/1 (--delete to enable)')
         self.assertEqual(c.last_timestamp, 10)
     # allow delete but dryrun
     with LogCapture() as lc:
         c.dryrun = True
         c.logger = logging.getLogger('resync.client')
         n = c.delete_resource(resource, filename, allow_deletion=True)
         self.assertEqual(n, 0)
         self.assertTrue(
             lc.records[-1].msg.startswith('dryrun: would delete http://example.org/1'))
     c.dryrun = False
     # allow delete but no resource present
     with LogCapture() as lc:
         c.logger = logging.getLogger('resync.client')
         n = c.delete_resource(resource, filename, allow_deletion=True)
         self.assertEqual(n, 0)
         self.assertTrue(
             lc.records[-1].msg.startswith('Failed to DELETE http://example.org/1'))
     # successful deletion, first make file...
     with open(filename, 'w') as fh:
         fh.write('delete me')
         fh.close()
     with LogCapture() as lc:
         c.logger = logging.getLogger('resync.client')
         n = c.delete_resource(resource, filename, allow_deletion=True)
         self.assertEqual(n, 1)
         self.assertTrue(lc.records[-1].msg.startswith('Event: {'))
         self.assertTrue(
             lc.records[-2].msg.startswith('deleted: http://example.org/1 ->'))
Example #23
0
    def add_capability_list(self, capability_list=None):
        """Add a capability list.

        Adds either a CapabiltyList object specified in capability_list
        or else creates a Resource with the URI given in capability_list
        and adds that to the Source Description
        """
        if (hasattr(capability_list, 'uri')):
            r = Resource(uri=capability_list.uri,
                         capability=capability_list.capability_name)
            if (capability_list.describedby is not None):
                r.link_set(rel='describedby', href=capability_list.describedby)
        else:
            r = Resource(uri=capability_list,
                         capability='capabilitylist')
        self.add(r)
Example #24
0
 def test_build_ex_25(self):
     cl = ChangeList()
     cl.up = "http://example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T11:00:00Z"
     c1 = Resource(uri="http://example.com/res1",
                   lastmod="2013-01-03T18:00:00Z",
                   change="updated")
     c1.link_add(rel="alternate",
                 href="http://example.com/res1.html",
                 modified="2013-01-03T18:00:00Z",
                 type="text/html") #FIXME - inconsistent
     c1.link_add(rel="alternate",
                 href="http://example.com/res1.pdf",
                 modified="2013-01-03T18:00:00Z",
                 type="application/pdf")
     cl.add( c1 )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_25' )
Example #25
0
 def test_build_ex_24(self):
     cl = ChangeList()
     cl.up = "http://example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T00:00:00Z"
     c1 = Resource(uri="http://example.com/res1",
                   lastmod="2013-01-03T18:00:00Z",
                   change="updated",
                   md5="1584abdf8ebdc9802ac0c6a7402c03b6",
                   length=8876,
                   mime_type="text/html")
     # Resource.link_set with add or change link depending on one with 
     # the particular rel exists unless allow_duplicates=True. 
     # Resource.link_add will always add. Test both here...
     c1.link_set(rel="duplicate",
                 href="http://mirror1.example.com/res1",
                 pri="1",
                 modified="2013-01-03T18:00:00Z")
     c1.link_set(rel="duplicate",
                 href="http://mirror2.example.com/res1",
                 pri="2",
                 modified="2013-01-03T18:00:00Z",
                 allow_duplicates=True)
     c1.link_add(rel="duplicate",
                 href="gsiftp://gridftp.example.com/res1",
                 pri="3",
                 modified="2013-01-03T18:00:00Z")
     cl.add( c1 )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_24' )
Example #26
0
 def test_build_ex_33(self):
     cl = ChangeList()
     cl.up = "http://aggregator2.example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T12:00:00Z"
     c1 = Resource(uri="http://aggregator2.example.com/res1.html",
                   lastmod="2013-01-04T09:00:00Z",
                   change="updated",
                   md5="1584abdf8ebdc9802ac0c6a7402c03b6",
                   length=8876,
                   mime_type="text/html" )
     c1.link_add(rel="via",
                 href="http://original.example.com/res1.html",
                 modified="2013-01-03T07:00:00Z",
                 hash="md5:1584abdf8ebdc9802ac0c6a7402c03b6",
                 length="8876",
                 type="text/html")
     cl.add( c1 )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_33' )
Example #27
0
 def test_build_ex_22(self):
     """Change Dump with three dump files"""
     cd = ChangeDump()
     cd.up = 'http://example.com/dataset1/capabilitylist.xml'
     cd.md_from="2013-01-01T00:00:00Z"
     z1 = Resource( uri='http://example.com/20130101-changedump.zip',
                    lastmod='2013-01-01T23:59:59Z',
                    length=3109,
                    md_from="2013-01-01T00:00:00Z",
                    md_until="2013-01-02T00:00:00Z",
                    mime_type="application/zip" )
     z1.contents='http://example.com/20130101-changedump-manifest.xml'
     z2 = Resource( uri='http://example.com/20130102-changedump.zip',
                    lastmod='2013-01-02T23:59:59Z',
                    length=6629,
                    md_from="2013-01-02T00:00:00Z",
                    md_until="2013-01-03T00:00:00Z",
                    mime_type="application/zip" )
     z2.contents='http://example.com/20130102-changedump-manifest.xml'
     z3 = Resource( uri='http://example.com/20130103-changedump.zip',
                    lastmod='2013-01-03T23:59:59Z',
                    length=8124,
                    md_from="2013-01-03T00:00:00Z",
                    md_until="2013-01-04T00:00:00Z",
                    mime_type="application/zip" )
     z3.contents='http://example.com/20130103-changedump-manifest.xml'
     cd.add( [z1, z2, z3] )
     ex_xml = self._open_ex('resourcesync_ex_22').read()
     self._assert_xml_equal( cd.as_xml(), ex_xml ) 
Example #28
0
 def test_build_ex_27(self):
     cl = ChangeList()
     cl.up = "http://example.com/dataset1/capabilitylist.xml"
     cl.md_from = "2013-01-03T00:00:00Z"
     c1 = Resource(uri="http://example.com/res4",
                   lastmod="2013-01-03T17:00:00Z",
                   change="updated",
                   sha256="f4OxZX_x_DFGFDgghgdfb6rtSx-iosjf6735432nklj",
                   length=56778,
                   mime_type="application/json" )
     c1.link_set(rel="http://www.openarchives.org/rs/terms/patch",
                 href="http://example.com/res4-json-patch",
                 modified="2013-01-03T17:00:00Z",
                 hash="sha-256:y66dER_t_HWEIKpesdkeb7rtSc-ippjf9823742opld", #FIXME - inconsistent
                 length=73,
                 type="application/json-patch")
     c2 = Resource(uri="http://example.com/res5-full.tiff",
                   lastmod="2013-01-03T18:00:00Z",
                   change="updated",
                   sha256="f4OxZX_x_FO5LcGBSKHWXfwtSx-j1ncoSt3SABJtkGk",
                   length="9788456778",
                   mime_type="image/tiff")
     c2.link_set(rel="http://www.openarchives.org/rs/terms/patch",
                 href="http://example.com/res5-diff",
                 modified="2013-01-03T18:00:00Z",
                 hash="sha-256:h986gT_t_87HTkjHYE76G558hY-jdfgy76t55sadJUYT",
                 length=4533,
                 type="application/x-tiff-diff" )
     cl.add( [c1,c2] )
     self._assert_xml_equal_ex( cl.as_xml(), 'resourcesync_ex_27' )
Example #29
0
 def test01c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource('a')
     r1lm = '2012-01-01T00:00:00Z'
     r1.lastmod = r1lm
     r2 = Resource('a')
     for r2lm in ('2012',
                  '2012-01',
                  '2012-01-01',
                  '2012-01-01T00:00Z',
                  '2012-01-01T00:00:00Z',
                  '2012-01-01T00:00:00.000000Z',
                  '2012-01-01T00:00:00.000000000000Z',
                  '2012-01-01T00:00:00.000000000001Z', #below resolution
                  '2012-01-01T00:00:00.00+00:00',
                  '2012-01-01T00:00:00.00-00:00',
                  '2012-01-01T02:00:00.00-02:00',
                  '2011-12-31T23:00:00.00+01:00'
                  ):
         r2.lastmod = r2lm
         self.assertEqual( r1.timestamp, r2.timestamp, ('%s (%f) == %s (%f)' % (r1lm,r1.timestamp,r2lm,r2.timestamp)) )
         self.assertEqual( r1, r2 )
Example #30
0
 def test1c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource("a")
     r1.lastmod = "2012-01-02"
     r2 = Resource("a")
     for r2lm in (
         "2012-01-02",
         "2012-01-02T00:00",
         "2012-01-02T00:00:00",
         "2012-01-02 00:00:00",
         "2012-01-02T00:00:00.00",
         "2012-01-02T00:00:00.000000000000",
         "2012-01-02T00:00:00.000000000001",  # below resolution
         "2012-01-02T00:00:00.00Z",
         "2012-01-02T00:00:00.00+0000",
         "2012-01-02T00:00:00.00-0000",
         "2012-01-02T00:00:00.00+00:00",
         "2012-01-02T00:00:00.00-00:00",
         "2012-01-02T00:00:00.00+02:00",  # FIXME - TZ info currently ignored
     ):
         r2.lastmod = r2lm
         self.assertEqual(r1.timestamp, r2.timestamp)
         self.assertEqual(r1.timestamp, r2.timestamp, ("2012-01-02 == %s" % r2lm))
         self.assertEqual(r1, r2)