Beispiel #1
0
    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)
Beispiel #2
0
    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)
Beispiel #3
0
    def test_get_all_generic_methods_filenames(self):
        """test_get_all_generic_methods_filenames should return a list of all generic_methods files"""
        base_dir = ncf.get_root_dir() + "/tree/30_generic_methods"
        conf_repo_dir = "/var/rudder/configuration-repository/ncf/30_generic_methods"
        alternative_path = os.path.dirname(
            os.path.realpath(__file__)) + "/test_methods"

        # Get list of generic_methods without prefix "_" on the filesystem
        list_methods_files = []
        ## Get recursively 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(conf_repo_dir)
            for filename in files
            if not filename.startswith('_') and filename.endswith('.cf')
        ]

        filenames = ncf.get_all_generic_methods_filenames()

        filenames.sort()
        list_methods_files.sort()

        self.assertEqual(filenames, list_methods_files)
Beispiel #4
0
 def test_get_ncf_root_dir(self):
   self.assertEquals(ncf.get_root_dir(), os.path.realpath(os.path.dirname(os.path.realpath(__file__)) + "/../../"))
Beispiel #5
0
 def test_get_ncf_root_dir(self):
     self.assertEqual(
         ncf.get_root_dir(),
         os.path.realpath(
             os.path.dirname(os.path.realpath(__file__)) + "/../../"))