def test_05_valid(self): print("-----", sys._getframe().f_code.co_name, "-----") targetobj = json.loads(DEFAULT_JSON) domainhex = "0000000000000000000000000000000000000000000000000000000000000000" k1obj = {"key": "use_ledger_subsystem", "value": False} k2obj = {"key": None, "value": None} fpath = "test05output.json" put_proc(targetobj, domainhex, k1obj, k2obj, fpath) with open(fpath, "r") as f: loadobj = json.load(f) assert loadobj["domains"][domainhex][k1obj['key']] == k1obj["value"] os.remove(fpath)
def test_55_invalid(self): print("-----", sys._getframe().f_code.co_name, "-----") targetobj = json.loads(DEFAULT_JSON) domainhex = "0000000000000000000000000000000000000000000000000000000000000000" k1obj = {"key": None, "value": None} k2obj = {"key": 'subsystem', "value": "ethereum2"} fpath = "test55output.json" ret = put_proc(targetobj, domainhex, k1obj, k2obj, fpath) assert ret == False
def test_52_invalid(self): print("-----", sys._getframe().f_code.co_name, "-----") targetobj = json.loads(DEFAULT_JSON) domainhex = None k1obj = {"key": "ledger_subsystem", "value": False} k2obj = {"key": "max_seconds", "value": 7200} fpath = "test52output.json" ret = put_proc(targetobj, domainhex, k1obj, k2obj, fpath) assert ret == False
def test_58_valid(self): os.mkdir('sample_config') shutil.copy('sample_config.json', 'sample_config/sample_config.json') fpath = "sample_config/sample_config.json" print("-----", sys._getframe().f_code.co_name, "-----") with open(fpath, "r") as f: targetobj = json.load(f) domainhex = "0000000000000000000000000000000000000000000000000000000000000000" k1obj = {"key": "use_ledger_subsystem", "value": False} k2obj = {"key": None, "value": None} outfpath = "sample_config2/sample_config.json" ret = put_proc(targetobj, domainhex, k1obj, k2obj, outfpath) assert ret == False os.remove('sample_config/sample_config.json')