예제 #1
0
 def test_update(self):
     config = LoggingConfiguration()
     config.clear()
     now = datetime.utcnow()
     result = config.master_contacted(update=True, announcement=False)
     self.assertDateAlmostEqual(now, result)
     self.assertIs(result, config["last_master_contact"])
예제 #2
0
 def test_update_default(self):
     config = LoggingConfiguration()
     config.clear()
     now = datetime.utcnow()
     result = config.master_contacted()
     self.assertDateAlmostEqual(now, result)
     self.assertIs(result, config["last_master_contact"])
     self.assertNotIn("last_announce", config)
예제 #3
0
 def test_announce(self):
     config = LoggingConfiguration()
     config.clear()
     now = datetime.utcnow()
     config.master_contacted(announcement=True)
     self.assertDateAlmostEqual(now, config["last_announce"])
예제 #4
0
 def test_no_update(self):
     config = LoggingConfiguration()
     config.clear()
     self.assertIsNone(config.master_contacted(update=False))
     self.assertNotIn("last_announce", config)
     self.assertNotIn("last_master_contact", config)