def test_get_all_techniques_filenames(self): """test_get_all_techniques_filenames should return a list of all techniques files""" base_dir = ncf.get_root_dir() + "/tree/50_techniques" alternative_path = os.path.dirname( os.path.realpath(__file__)) + "/test_methods" # Get list of techniques without prefix "_" on the filesystem list_methods_files = [] ## Get recursivly each promises in the basic path and the alternative one list_methods_files += [ os.path.join(full_path, filename) for full_path, dirname, files in os.walk(base_dir) for filename in files if not filename.startswith('_') and filename.endswith('.cf') ] list_methods_files += [ os.path.join(full_path, filename) for full_path, dirname, files in os.walk(alternative_path + "/50_techniques") for filename in files if not filename.startswith('_') and filename.endswith('.cf') ] filenames = ncf.get_all_techniques_filenames(alternative_path) filenames.sort() list_methods_files.sort() self.assertEqual(filenames, list_methods_files)
def test_get_all_techniques_metadata_with_args(self): """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called""" alternative_path = os.path.dirname(os.path.realpath(__file__)) + "/test_methods" metadata = ncf.get_all_techniques_metadata(alt_path=alternative_path) number = len(ncf.get_all_techniques_filenames(alternative_path)) self.assertEquals(number, len(metadata))
def test_get_all_techniques_filenames(self): """test_get_all_techniques_filenames should return a list of all techniques files""" base_dir = ncf.get_root_dir() + "/tree/50_techniques" alternative_path = os.path.dirname(os.path.realpath(__file__)) + "/test_methods" # Get list of techniques without prefix "_" on the filesystem list_methods_files = [] ## Get recursivly each promises in the basic path and the alternative one list_methods_files += [ os.path.join(full_path, filename) for full_path, dirname, files in os.walk(base_dir) for filename in files if not filename.startswith("_") and filename.endswith(".cf") ] list_methods_files += [ os.path.join(full_path, filename) for full_path, dirname, files in os.walk(alternative_path + "/50_techniques") for filename in files if not filename.startswith("_") and filename.endswith(".cf") ] filenames = ncf.get_all_techniques_filenames(alternative_path) filenames.sort() list_methods_files.sort() self.assertEquals(filenames, list_methods_files)
def test_get_all_techniques_metadata(self): """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called""" metadata = ncf.get_all_techniques_metadata() data = metadata["data"] errors = metadata["errors"] all_metadata = len(data) + len(errors) all_files = len(ncf.get_all_techniques_filenames()) self.assertEquals(all_files, all_metadata)
def test_get_all_techniques_metadata(self): """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called""" metadata = ncf.get_all_techniques_metadata() data = metadata["data"]["techniques"] errors = metadata["errors"] all_metadata = len(data) + len(errors) all_files = len(ncf.get_all_techniques_filenames()) self.assertEqual(all_files, all_metadata)
def test_get_all_techniques_metadata_with_args(self): """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called""" alternative_path = os.path.dirname(os.path.realpath(__file__)) + "/test_methods" metadata = ncf.get_all_techniques_metadata(alt_path=alternative_path) data = metadata["data"] errors = metadata["errors"] all_metadata = len(data) + len(errors) all_files = len(ncf.get_all_techniques_filenames(alternative_path)) self.assertEquals(all_files, all_metadata)
def test_get_all_techniques_metadata_with_args(self): """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called""" alternative_path = os.path.dirname( os.path.realpath(__file__)) + "/test_methods" metadata = ncf.get_all_techniques_metadata(alt_path=alternative_path) data = metadata["data"] errors = metadata["errors"] all_metadata = len(data) + len(errors) all_files = len(ncf.get_all_techniques_filenames(alternative_path)) self.assertEqual(all_files, all_metadata)
def test_get_all_techniques_metadata(self): """get_all_techniques_metadata should return a list of all techniques with all defined metadata tags and methods_called""" metadata = ncf.get_all_techniques_metadata() number = len(ncf.get_all_techniques_filenames()) self.assertEquals(number, len(metadata))