def test_dir_file_type(self): # check input type function my_dir_file=fc.ArchCompare(archive_a=self.t_foldera,archive_b=self.t_filea,json_config=self.t_json) assert my_dir_file.check_input() == ('dir','file') , 'Directory n file test OK' my_dir_tar=fc.ArchCompare(archive_a=self.t_foldera,archive_b=self.t_tara,json_config=self.t_json) assert ('dir','tar')== my_dir_tar.check_input(),'directory n tar test OK' my_tar_tar=fc.ArchCompare(archive_a=self.t_tarb,archive_b=self.t_tara,json_config=self.t_json) assert ('tar','tar') == my_tar_tar.check_input(),'tar n tar test OK' my_dir_dir=fc.ArchCompare(archive_a=self.t_foldera,archive_b=self.t_folderb,json_config=self.t_json) assert ('dir','dir')== my_dir_dir.check_input(),'directory n directory test OK' my_file_file=fc.ArchCompare(archive_a=self.t_filea,archive_b=self.t_fileb,json_config=self.t_json) assert ('file','file') == my_file_file.check_input(),'file n file test OK'
def test_get_file_metadata(self): my_dir_file = fc.ArchCompare(archive_a=self.t_foldera, archive_b=self.t_filea, json_config=self.t_json) assert ('samplea.caveman_c.annot.vcf.gz', '.vcf.gz', 2055) == my_dir_file._get_file_metadata( self.t_filea), 'file metadata test ok'
def test_format_file_input(self): my_dir_file = fc.ArchCompare(archive_a=self.t_foldera, archive_b=self.t_filea, json_config=self.t_json, cmp_type=self.cmp_type) assert self.file_dict == my_dir_file._format_file_input( self.t_filea), 'test_format_file_input OK'
def test_format_dir_input(self): self.maxDiff = None my_dir_file = fc.ArchCompare(archive_a=self.t_foldera, archive_b=self.t_filea, json_config=self.t_json, cmp_type=self.cmp_type) assert self.format_dir_dictA == my_dir_file._format_dir_input( self.t_foldera), 'test_format_dir_input OK'
def test_no_ext(self): self.maxDiff = None my_dir_dir_no_ext = fc.ArchCompare(archive_a=self.t_foldera, archive_b=self.t_folderb, json_config=self.t_ignore_ext_json, cmp_type=['diffs']) assert self.no_ext_cmp_dict == my_dir_dir_no_ext._do_comparison( self.format_dir_dictA, self.format_dir_dictB, self.common_files), 'test_do_no_extComparison OK'
def test_size(self): self.maxDiff = None my_dir_dir_size = fc.ArchCompare(archive_a=self.t_foldera, archive_b=self.t_folderb, json_config=self.t_json, cmp_type=['size']) assert self.size_cmp_dict == my_dir_dir_size._do_comparison( self.format_dir_dictA, self.format_dir_dictB, self.common_files), 'test_do_sizeComparison OK'
def test_checksum(self): self.maxDiff = None my_dir_dir_checksum = fc.ArchCompare(archive_a=self.t_foldera, archive_b=self.t_folderb, json_config=self.t_json, cmp_type=['checksum']) assert self.checksum_cmp_dict == my_dir_dir_checksum._do_comparison( self.format_dir_dictA, self.format_dir_dictB, self.common_files), 'test_do_checksumComparison OK'
def test_name(self): self.maxDiff = None my_tar_tar_cmp = fc.ArchCompare(archive_a=self.t_tara, archive_b=self.t_tarb, json_config=self.t_json, cmp_type=['name']) assert self.name_cmp_dict == my_tar_tar_cmp._do_comparison( self.format_dir_dictA, self.format_dir_dictB, self.common_files), 'test_do_nameComparison OK'
def test_format_tar_input(self): self.maxDiff = None my_tar_tar = fc.ArchCompare(archive_a=self.t_tara, archive_b=self.t_tarb, json_config=self.t_json, cmp_type=self.tar_cmp_type) assert self.format_tar_dictA == my_tar_tar._format_tar_input( self.t_tara), 'test_format_tar_inputA OK' assert self.format_tar_dictB == my_tar_tar._format_tar_input( self.t_tarb), 'test_format_tar_inputB OK'
def test_get_sets(self): my_tar_file=fc.ArchCompare(archive_a=self.t_tara,archive_b=self.t_filea,json_config=self.t_json,cmp_type=['name']) assert self.name_cmp_dict == my_tar_file._get_sets_to_compare(self.format_dir_dictA,self.format_dir_dictB),'test_get_sets OK'