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