def test_update_raw_data_from_cmd_wrong_raw_data_id(self): # Using max(raw_data_ids) + 1 to make sure that the raw data id # passed does not belong to the study with self.assertRaises(ValueError): update_raw_data_from_cmd(self.filepaths, self.filepaths_types, self.study.id, max(self.study.raw_data()) + 1)
def test_update_raw_data_from_cmd_diff_length(self): with self.assertRaises(ValueError): update_raw_data_from_cmd(self.filepaths[1:], self.filepaths_types, self.study.id) with self.assertRaises(ValueError): update_raw_data_from_cmd(self.filepaths, self.filepaths_types[1:], self.study.id)
def test_update_raw_data_from_cmd_rd_id(self): rd = update_raw_data_from_cmd(self.filepaths, self.filepaths_types, self.study.id, self.study.raw_data()[0]) # Make sure that we are cleaning the environment for _, fp, _ in rd.get_filepaths(): self._clean_up_files.append(fp) # The checkums are in filepath order. If we sort the rd.get_filepath() # result by the filepath (itemgetter(1)) we will get them in the same # order, so the checksums will not fail for obs, exp in zip(sorted(rd.get_filepaths(), key=itemgetter(1)), self.checksums): self.assertEqual(compute_checksum(obs[1]), exp)
def test_update_raw_data_from_cmd_no_raw_data(self): with self.assertRaises(ValueError): update_raw_data_from_cmd(self.filepaths, self.filepaths_types, self.new_study.id)