def test_remove_invalid(self, path): with self.settings() as settings: try: settings.remove(path, error_on_path=True) self.fail("Expected NoSuchSettingsPath") except octoprint.settings.NoSuchSettingsPath: pass
def test_remove_invalid(self, path): with self.mocked_config(): settings = octoprint.settings.Settings() try: settings.remove(path, error_on_path=True) self.fail("Expected NoSuchSettingsPath") except octoprint.settings.NoSuchSettingsPath: pass
def test_remove(self): with self.mocked_config(): settings = octoprint.settings.Settings() self.assertTrue("port" in settings._config["server"]) settings.remove(["server", "port"]) self.assertFalse("port" in settings._config["server"]) self.assertEqual(5000, settings.get(["server", "port"]))
def test_remove(self): with self.settings() as settings: self.assertTrue("port" in settings._config["server"]) settings.remove(["server", "port"]) self.assertFalse( "server" in settings._config and "port" in settings._config["server"] ) self.assertEqual(5000, settings.get(["server", "port"]))