Beispiel #1
0
    def test_css_top_files_ordered(self):
        """
        Make sure that the
         
        This is only important if there are multiple
        settings.CSS_TOP_FILES and matches found
         
        TODO:Finish this test 
        """

        top, std, bottom = heavy_lifting.organize_css_files(
            self.fake_file_list)

        if len(top) > 1 and len(list_css_top_files()) > 1:
            for found_file in top:
                found_file_name = os.path.basename(found_file)

                for f_file_again in top:
                    f_file_again_name = os.path.basename(f_file_again)

                    if not found_file_name == f_file_again_name:
                        if top.index(found_file) > top.index(f_file_again):
                            self.assertGreater(
                                list_css_top_files().index(found_file_name),
                                list_css_top_files().index(f_file_again_name))

                        if top.index(found_file) < top.index(f_file_again):
                            self.assertLess(
                                list_css_top_files().index(found_file_name),
                                list_css_top_files().index(f_file_again_name))
Beispiel #2
0
    def test_css_top_files_ordered(self):
        """
        Make sure that the
         
        This is only important if there are multiple
        settings.CSS_TOP_FILES and matches found
         
        TODO:Finish this test 
        """
         
        top, std, bottom = heavy_lifting.organize_css_files(self.fake_file_list)
         
        if len(top) > 1 and len(list_css_top_files()) > 1:
            for found_file in top:
                found_file_name = os.path.basename(found_file)
                 
                         
                for f_file_again in top:
                    f_file_again_name = os.path.basename(f_file_again)
                             
                    if not found_file_name == f_file_again_name:
                        if top.index(found_file) > top.index(f_file_again):
                            self.assertGreater(list_css_top_files().index(found_file_name), list_css_top_files().index(f_file_again_name))
 
                        if top.index(found_file) < top.index(f_file_again):
                            self.assertLess(list_css_top_files().index(found_file_name), list_css_top_files().index(f_file_again_name))
Beispiel #3
0
 def test_css_top_files_list(self):
     """
     Make sure that list_css_top_files matches 
     either settings.CSS_TOP_FILES or an empty list
     """
     try:
         self.assertEquals(settings.CSS_TOP_FILES, list_css_top_files())
     except AttributeError:
         self.assertEquals([], list_css_top_files())
Beispiel #4
0
 def test_css_top_files_list(self):
     """
     Make sure that list_css_top_files matches 
     either settings.CSS_TOP_FILES or an empty list
     """
     try:
         self.assertEquals(settings.CSS_TOP_FILES, list_css_top_files())
     except AttributeError:
         self.assertEquals([], list_css_top_files())
Beispiel #5
0
 def test_css_top_files_belong(self):
     """
     Make sure that all top files returned by the organize_css_files belong there
     """
     top, std, bottom = heavy_lifting.organize_css_files(self.fake_file_list)
     for fle in top:
         self.assertIn(os.path.basename(fle), list_css_top_files())
Beispiel #6
0
def organize_css_files(file_list):
    """
    Organize the mass of CSS files into top, middle, bottom
    
    app css files will come before main css files in each category
    """
    top_list = []
    std_list = []
    bot_list = []

    top_watch = list_css_top_files()
    bot_watch = list_css_bottom_files()

    for watch in top_watch:
        for file_fullpath in file_list:
            file_name = os.path.basename(file_fullpath)
            if file_name == watch:
                top_list.append(file_fullpath)

    for watch in bot_watch:
        for file_fullpath in file_list:
            file_name = os.path.basename(file_fullpath)
            if file_name == watch:
                bot_list.append(file_fullpath)

    for file_fullpath in file_list:
        if not file_fullpath in top_list and not file_fullpath in bot_list:
            file_name = os.path.basename(file_fullpath)
            std_list.append(file_fullpath)

    return (top_list, std_list, bot_list)
Beispiel #7
0
 def test_css_top_files_belong(self):
     """
     Make sure that all top files returned by the organize_css_files belong there
     """
     top, std, bottom = heavy_lifting.organize_css_files(
         self.fake_file_list)
     for fle in top:
         self.assertIn(os.path.basename(fle), list_css_top_files())