def test_difference_json(): print('in difference json') actual = generate_diff( first_json_filepath, second_json_filepath, format_output='json' ) first_file = get_dict(first_yaml_filepath) second_file = get_dict(second_yaml_filepath) expect = json.make_json(make_diffs(first_file, second_file)) assert actual == expect
def generate_diff(first_file, second_file, format_output="stylish"): """Get the difference of the files. Args: first_file: First second_file: Second format_output: Format Returns: str: Generated output. """ dict1 = get_dict(first_file) dict2 = get_dict(second_file) diff = make_diffs(dict1, dict2) if format_output == "plain": return make_plain(diff) elif format_output == "json": return make_json(diff) return make_stylish(diff)
def test_dict_formatting(): print('in test_dict_formatting') first_file = get_dict(first_json_filepath) second_file = get_dict(second_json_filepath) actual = json.dict_formatting(make_diffs(first_file, second_file)) assert actual == dict_formatting_correct
def test_make_json(): print('in test_make_json') first_file = get_dict(first_json_filepath) second_file = get_dict(second_json_filepath) data = make_diffs(first_file, second_file) assert json.make_json(data) == json_correct
def test_plain_second(): print('in test_plain_second') first_file = get_dict(first_yaml_filepath) second_file = get_dict(second_yaml_filepath) data = make_diffs(first_file, second_file) assert plain.make_plain(data) == plain_correct
def test_stylish_second(): print('in test_stylish_second') first_file = get_dict(first_yaml_filepath) second_file = get_dict(second_yaml_filepath) data = make_diffs(first_file, second_file) assert stylish.make_stylish(data) == stylish_correct
def test_make_diffs_second(): print('in test_make_diffs_second') first_file = get_dict(first_yaml_filepath) second_file = get_dict(second_yaml_filepath) assert isinstance(make_diffs(first_file, second_file), list)