Ejemplo n.º 1
0
 def test_uses_default_filename_with_incomplete_content_disposition_header(
         self):
     self.assertEqual(
         self.DEFAULT_FILENAME,
         attachment_file_name([('content-type', 'application/pdf'),
                               ('cache-control', 'private'),
                               ('content-disposition')],
                              self.DEFAULT_FILENAME))
Ejemplo n.º 2
0
 def test_handles_capitalized_header_name(self):
     self.assertEqual(
         self.FILENAME,
         attachment_file_name(
             [('content-type', 'application/pdf'),
              ('cache-control', 'private'),
              ('Content-Disposition',
               'attachment; filename="' + self.FILENAME + '"')],
             self.DEFAULT_FILENAME))
Ejemplo n.º 3
0
 def test_uses_filename_in_content_disposition_header(self):
     self.assertEqual(
         self.FILENAME,
         attachment_file_name(
             [('content-type', 'application/pdf'),
              ('cache-control', 'private'),
              ('content-disposition',
               'attachment; filename="' + self.FILENAME + '"')],
             self.DEFAULT_FILENAME))
Ejemplo n.º 4
0
    def run(self):
        format = self.get_option('format')
        report = self.api.report(convert_to_mime_type(format, 'text'))

        if format == 'pdf':
            save_report(report[0], attachment_file_name(report[1], 'katello_users_report.pdf'))
        else:
            print report[0]

        return os.EX_OK
Ejemplo n.º 5
0
    def run(self):
        orgId = self.get_option('org')
        envName = self.get_option('environment')
        format = self.get_option('format')

        if envName is None:
            report = self.api.report_by_org(orgId, convert_to_mime_type(format, 'text'))
        else:
            environment = get_environment(orgId, envName)
            report = self.api.report_by_env(environment['id'], convert_to_mime_type(format, 'text'))

        if format == 'pdf':
            save_report(report[0], attachment_file_name(report[1], 'katello_systems_report.pdf'))
        else:
            print report[0]

        return os.EX_OK
Ejemplo n.º 6
0
    def run(self):
        orgId = self.get_option("org")
        envName = self.get_option("environment")
        format_in = self.get_option("format")

        if envName is None:
            report = self.api.report_by_org(orgId, convert_to_mime_type(format_in, "text"))
        else:
            environment = get_environment(orgId, envName)
            report = self.api.report_by_env(environment["id"], convert_to_mime_type(format_in, "text"))

        if format_in == "pdf":
            save_report(report[0], attachment_file_name(report[1], "%s_systems_report.pdf" % get_katello_mode()))
        else:
            print report[0]

        return os.EX_OK
Ejemplo n.º 7
0
    def run(self):
        orgId = self.get_option('org')
        envName = self.get_option('environment')
        format = self.get_option('format')

        if envName is None:
            report = self.api.report_by_org(
                orgId, convert_to_mime_type(format, 'text'))
        else:
            environment = get_environment(orgId, envName)
            report = self.api.report_by_env(
                environment['id'], convert_to_mime_type(format, 'text'))

        if format == 'pdf':
            save_report(
                report[0],
                attachment_file_name(report[1], 'katello_systems_report.pdf'))
        else:
            print report[0]

        return os.EX_OK
Ejemplo n.º 8
0
 def test_uses_default_filename_with_incomplete_content_disposition_header(self):
     self.assertEqual(self.DEFAULT_FILENAME, attachment_file_name([
         ('content-type', 'application/pdf'),
         ('cache-control', 'private'),
         ('content-disposition')], self.DEFAULT_FILENAME))
Ejemplo n.º 9
0
 def test_handles_capitalized_header_name(self):
     self.assertEqual(self.FILENAME, attachment_file_name([
         ('content-type', 'application/pdf'),
         ('cache-control', 'private'),
         ('Content-Disposition', 'attachment; filename="' + self.FILENAME + '"')], self.DEFAULT_FILENAME))
Ejemplo n.º 10
0
 def test_uses_filename_in_content_disposition_header(self):
     self.assertEqual(self.FILENAME, attachment_file_name([
         ('content-type', 'application/pdf'),
         ('cache-control', 'private'),
         ('content-disposition', 'attachment; filename="' + self.FILENAME + '"')], self.DEFAULT_FILENAME))