def test_json2csv_full(self): test_json = self.get_test_loc('json2csv/full.json') result_file = self.get_temp_file('.csv') with open(result_file, 'wb') as rf: json2csv.json_scan_to_csv(test_json, rf) expected_file = self.get_test_loc('json2csv/full.csv') check_csvs(result_file, expected_file)
def test_can_process_scan_from_json_scan(self): import scancode from commoncode.command import execute test_dir = self.get_test_loc('livescan/scan') json_file = self.get_temp_file('json') scan_cmd = os.path.join(scancode.root_dir, 'scancode') rc, _stdout, _stderr = execute(scan_cmd, ['-clip', '--email', '--url', '--strip-root', '--format', 'json', test_dir, json_file]) assert rc == 0 result_file = self.get_temp_file('.csv') with open(result_file, 'wb') as rf: json2csv.json_scan_to_csv(json_file, rf) expected_file = self.get_test_loc('livescan/expected.csv') check_csvs(result_file, expected_file)
def test_can_process_scan_from_json_scan(self): import scancode from commoncode.command import execute test_dir = self.get_test_loc('livescan/scan') json_file = self.get_temp_file('json') scan_cmd = os.path.join(scancode.root_dir, 'scancode') rc, _stdout, _stderr = execute(scan_cmd, [ '-clip', '--email', '--url', '--strip-root', '--format', 'json', test_dir, json_file ]) assert rc == 0 result_file = self.get_temp_file('.csv') with open(result_file, 'wb') as rf: json2csv.json_scan_to_csv(json_file, rf) expected_file = self.get_test_loc('livescan/expected.csv') check_csvs(result_file, expected_file)