def testTimesAuto(self): meta = MetaData() before = time.time() meta.setCreateTime(None) meta.setSendTime(None) meta.setReceiveTime(None) meta.setDeliverTime(None) after = time.time() self.assertNotEquals(None, meta.getCreateTime()) self.assertNotEquals(None, meta.getSendTime()) self.assertNotEquals(None, meta.getReceiveTime()) self.assertNotEquals(None, meta.getDeliverTime()) self.assertTrue(before <= meta.getCreateTime()) self.assertTrue(before <= meta.getSendTime()) self.assertTrue(before <= meta.getReceiveTime()) self.assertTrue(before <= meta.getDeliverTime()) self.assertTrue(after >= meta.getCreateTime()) self.assertTrue(after >= meta.getSendTime()) self.assertTrue(after >= meta.getReceiveTime()) self.assertTrue(after >= meta.getDeliverTime())
def testConstruction(self): before = time.time() meta = MetaData() after = time.time() self.assertTrue(meta.getCreateTime() != None) self.assertTrue(meta.getSendTime() == None) self.assertTrue(meta.getReceiveTime() == None) self.assertTrue(meta.getDeliverTime() == None) self.assertTrue(meta.getCreateTime() >= before) self.assertTrue(meta.getCreateTime() <= after)
def testComparison(self): meta1 = MetaData() meta2 = MetaData() meta2.setCreateTime(meta1.getCreateTime()) self.assertEquals(meta1, meta2) meta1.setCreateTime(213123) self.assertNotEquals(meta1, meta2) meta2.setCreateTime(meta1.getCreateTime()) self.assertEquals(meta1, meta2) meta1.setSendTime() self.assertNotEquals(meta1, meta2) meta2.setSendTime(meta1.getSendTime()) self.assertEquals(meta1, meta2) meta1.setReceiveTime() self.assertNotEquals(meta1, meta2) meta2.setReceiveTime(meta1.getReceiveTime()) self.assertEquals(meta1, meta2) meta1.setDeliverTime() self.assertNotEquals(meta1, meta2) meta2.setDeliverTime(meta1.getDeliverTime()) self.assertEquals(meta1, meta2) meta1.setUserTime("foo") self.assertNotEquals(meta1, meta2) meta2.setUserTime("foo", meta1.getUserTimes()["foo"]) self.assertEquals(meta1, meta2) meta1.setUserInfo("foox", "bla") self.assertNotEquals(meta1, meta2) meta2.setUserInfo("foox", meta1.getUserInfos()["foox"]) self.assertEquals(meta1, meta2)