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

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

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

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

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

                        if bottom.index(found_file) < bottom.index(
                                f_file_again):
                            self.assertLess(
                                list_css_bottom_files().index(found_file_name),
                                list_css_bottom_files().index(
                                    f_file_again_name))
예제 #2
0
    def test_css_bottom_files_ordered(self):
        """
        Make sure that the
         
        This is only important if there are multiple
        settings.CSS_BOTTOM_FILES and matches found 
         
        TODO:Finish this test
        """
         
        top, std, bottom = heavy_lifting.organize_css_files(self.fake_file_list)
          
        if len(bottom) > 1 and len(list_css_bottom_files()) > 1:
            for found_file in bottom:
                found_file_name = os.path.basename(found_file)
                 
                         
                for f_file_again in bottom:
                    f_file_again_name = os.path.basename(f_file_again)
                             
                    if not found_file_name == f_file_again_name:
                        if bottom.index(found_file) > bottom.index(f_file_again):
                            self.assertGreater(list_css_bottom_files().index(found_file_name), list_css_bottom_files().index(f_file_again_name))
 
                        if bottom.index(found_file) < bottom.index(f_file_again):
                            self.assertLess(list_css_bottom_files().index(found_file_name), list_css_bottom_files().index(f_file_again_name))
예제 #3
0
 def test_css_bottom_files_list(self):
     """
     Make sure that list_css_bottom_files matches 
     either settings.CSS_BOTTOM_FILES or an empty list
     """
     try:
         self.assertEquals(settings.CSS_BOTTOM_FILES, list_css_bottom_files())
     except AttributeError:
         self.assertEquals([], list_css_bottom_files())
예제 #4
0
 def test_css_bottom_files_list(self):
     """
     Make sure that list_css_bottom_files matches 
     either settings.CSS_BOTTOM_FILES or an empty list
     """
     try:
         self.assertEquals(settings.CSS_BOTTOM_FILES,
                           list_css_bottom_files())
     except AttributeError:
         self.assertEquals([], list_css_bottom_files())
예제 #5
0
 def test_css_bottom_files_belong(self):
     """
     Make sure that all bottom files returned by the organize_css_files belong there
     """
     top, std, bottom = heavy_lifting.organize_css_files(self.fake_file_list)
     for fle in bottom:
         self.assertIn(os.path.basename(fle), list_css_bottom_files())
예제 #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)
예제 #7
0
 def test_css_bottom_files_belong(self):
     """
     Make sure that all bottom files returned by the organize_css_files belong there
     """
     top, std, bottom = heavy_lifting.organize_css_files(
         self.fake_file_list)
     for fle in bottom:
         self.assertIn(os.path.basename(fle), list_css_bottom_files())