Exemple #1
0
    def test_filename_generator(self, course_key):
        """
        Tests that the generator creates names based on course_id, base name, and date.
        """
        self.assertEqual(
            u'foo_bar_baz_file_1974-06-22-010203',
            course_and_time_based_filename_generator(course_key, 'file'))

        self.assertEqual(
            u'foo_bar_baz_base_name_ø_1974-06-22-010203',
            course_and_time_based_filename_generator(course_key,
                                                     ' base` name ø '))
Exemple #2
0
    def test_filename_generator(self, course_key):
        """
        Tests that the generator creates names based on course_id, base name, and date.
        """
        self.assertEqual(
            u'foo_bar_baz_file_1974-06-22-010203',
            course_and_time_based_filename_generator(course_key, 'file')
        )

        self.assertEqual(
            u'foo_bar_baz_base_name_ø_1974-06-22-010203',
            course_and_time_based_filename_generator(course_key, ' base` name ø ')
        )
Exemple #3
0
def build_answers_distribution_report_name(problem):
    """ Build a filename for answer distributions reports.

    The name is based on problem_module display_name and datetime. The report name
    won't exceed 255 bytes.

    Args:
         problem (CapaDescriptor): The problem we get answers distribution from.

    Returns:
        The answer distribution report name (Unicode).
    """
    running_report_name = course_and_time_based_filename_generator(
        problem.location, problem.display_name)
    running_report_name += u".csv"
    return running_report_name[:255]
Exemple #4
0
def build_answers_distribution_report_name(problem):
    """ Build a filename for answer distributions reports.

    The name is based on problem_module display_name and datetime. The report name
    won't exceed 255 bytes.

    Args:
         problem (CapaDescriptor): The problem we get answers distribution from.

    Returns:
        The answer distribution report name (Unicode).
    """
    running_report_name = course_and_time_based_filename_generator(problem.location,
                                                                   problem.display_name)
    running_report_name += u".csv"
    return running_report_name[:255]