def test_detect_incomplete_config(self): # Test a complete config config = Seedsync._create_default_config() incomplete_value = config.lftp.remote_address config.lftp.remote_address = "value" config.lftp.remote_password = "******" config.lftp.remote_username = "******" config.lftp.remote_path = "value" config.lftp.local_path = "value" config.lftp.remote_path_to_scan_script = "value" self.assertFalse(Seedsync._detect_incomplete_config(config)) # Test incomplete configs config.lftp.remote_address = incomplete_value self.assertTrue(Seedsync._detect_incomplete_config(config)) config.lftp.remote_address = "value" config.lftp.remote_username = incomplete_value self.assertTrue(Seedsync._detect_incomplete_config(config)) config.lftp.remote_username = "******" config.lftp.remote_path = incomplete_value self.assertTrue(Seedsync._detect_incomplete_config(config)) config.lftp.remote_path = "value" config.lftp.local_path = incomplete_value self.assertTrue(Seedsync._detect_incomplete_config(config)) config.lftp.local_path = "value" config.lftp.remote_path_to_scan_script = incomplete_value self.assertTrue(Seedsync._detect_incomplete_config(config)) config.lftp.remote_path_to_scan_script = "value"
def test_default_config(self): config = Seedsync._create_default_config() # Test that default config doesn't have any uninitialized values config_dict = config.as_dict() for section, inner_config in config_dict.items(): for key in inner_config: self.assertIsNotNone(inner_config[key], msg="{}.{} is uninitialized".format(section, key)) # Test that default config is a valid config config_dict = config.as_dict() config2 = Config.from_dict(config_dict) config2_dict = config2.as_dict() self.assertEqual(config_dict, config2_dict)