def test_merge_timeserver(self): fti_settings = copy.deepcopy(FTI) time = { "time_server": [ "time-server-4", "time-server-25", "tm-45" ], } merged = util.deepMerge(fti_settings, time) self.assertTrue(len(merged['time_server']) == 3) result = fti_settings result['time_server'] = time['time_server'] self.assertDictEqual(merged, result) fti_settings = copy.deepcopy(FTI) time = { "time_server": [], } merged = util.deepMerge(fti_settings, time) self.assertTrue(len(merged['time_server']) == 0) result = fti_settings result['time_server'] = time['time_server'] self.assertDictEqual(merged, result)
def test_merge_empty(self): fti_settings = {} proxy = { "http_proxy_settings": { "no_proxy": "10.*,20.*,localhost", "https_proxy": "secure-proxy", "http_proxy": "open-proxy" }, } merged = util.deepMerge(fti_settings, proxy) self.assertDictEqual(merged, proxy)
def test_merge_timezone(self): fti_settings = copy.deepcopy(FTI) time = { "locale_settings": { "time_zone": "Ireland" }, } merged = util.deepMerge(fti_settings, time) result = fti_settings result['locale_settings']['time_zone'] =\ time["locale_settings"]["time_zone"] self.assertDictEqual(merged, result)
def test_merge_full(self): fti_settings = copy.deepcopy(FTI) proxy = { "http_proxy_settings": { "no_proxy": "10.*,20.*,foo", "https_proxy": "foo-proxy", "http_proxy": "open-proxy" }, } merged = util.deepMerge(fti_settings, proxy) result = fti_settings result['http_proxy_settings'] = proxy['http_proxy_settings'] self.assertDictEqual(merged, result)