Esempio n. 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"])
Esempio n. 2
0
    def test_change_type_assert_missing_value(self):
        config = LoggingConfiguration()

        with self.assertRaises(AssertionError):
            config.changed(LoggingConfiguration.MODIFIED, "")

        with self.assertRaises(AssertionError):
            config.changed(LoggingConfiguration.CREATED, "")
Esempio n. 3
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)
Esempio n. 4
0
 def test_change_unknown_change_type(self):
     config = LoggingConfiguration()
     with self.assertRaises(NotImplementedError):
         config.changed("FOOBAR", "", "")
Esempio n. 5
0
 def test_announce(self):
     config = LoggingConfiguration()
     config.clear()
     now = datetime.utcnow()
     config.master_contacted(announcement=True)
     self.assertDateAlmostEqual(now, config["last_announce"])
Esempio n. 6
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)