def test_day_granularity(self): fakeclient = GranularityFakeClient(granularity="YYYY-MM-DDThh:mm:ssZ") fakeclient.updateGranularity() try: fakeclient.listRecords(from_=datetime(2003, 04, 10, 14, 0), metadataPrefix="oai_dc") except TestError, e: self.assertEquals("2003-04-10T14:00:00Z", e.kw["from"])
def test_day_granularity(self): fakeclient = GranularityFakeClient(granularity='YYYY-MM-DDThh:mm:ssZ') fakeclient.updateGranularity() try: fakeclient.listRecords(from_=datetime(2003, 4, 10, 14, 0), metadataPrefix='oai_dc') except TestError as e: self.assertEquals('2003-04-10T14:00:00Z', e.kw['from']) fakeclient = GranularityFakeClient(granularity='YYYY-MM-DD') fakeclient.updateGranularity() try: fakeclient.listRecords(from_=datetime(2003, 4, 10, 14, 0), until=datetime(2004, 6, 17, 15, 30), metadataPrefix='oai_dc') except TestError as e: self.assertEquals('2003-04-10', e.kw['from']) self.assertEquals('2004-06-17', e.kw['until'])
def test_day_granularity(self): fakeclient = GranularityFakeClient(granularity='YYYY-MM-DDThh:mm:ssZ') fakeclient.updateGranularity() try: fakeclient.listRecords(from_=datetime(2003, 04, 10, 14, 0), metadataPrefix='oai_dc') except TestError, e: self.assertEquals('2003-04-10T14:00:00Z', e.kw['from'])
] # lazy, just compare first two sets.. sets = fakeclient.listSets() sets = list(sets) compare = [sets[0], sets[1]] self.assertEquals(expected, compare) def test_day_granularity(self): fakeclient = GranularityFakeClient(granularity='YYYY-MM-DDThh:mm:ssZ') fakeclient.updateGranularity() try: fakeclient.listRecords(from_=datetime(2003, 04, 10, 14, 0), metadataPrefix='oai_dc') except TestError, e: self.assertEquals('2003-04-10T14:00:00Z', e.kw['from']) fakeclient = GranularityFakeClient(granularity='YYYY-MM-DD') fakeclient.updateGranularity() try: fakeclient.listRecords(from_=datetime(2003, 04, 10, 14, 0), until=datetime(2004, 06, 17, 15, 30), metadataPrefix='oai_dc') except TestError, e: self.assertEquals('2003-04-10', e.kw['from']) self.assertEquals('2004-06-17', e.kw['until']) def test_getRecord_unexpectedresponse(self): self.assertRaises(error.UnexpectedResponse, fakeclient.getRecord, metadataPrefix='oai_dc', identifier='hdl:1765/316')