예제 #1
0
    def test_completed_form_creates_hardcoded_filenames(self):
        post_dict = {"submit":"submit", "serial":"UT5555",
                     "coefficient_0":"100", "coefficient_1":"101", 
                     "coefficient_2":"102", "coefficient_3":"103"}
        result = self.post_calibration_report(post_dict)

        self.assertTrue(file_range("reports/ut5555/report.pdf", 106473,
                                   ok_range=40000))
        self.assertTrue(file_range("reports/ut5555/report.png", 220137,
                                   ok_range=40000))
예제 #2
0
    def test_thumbnail_generation(self):
        # Create the default report
        from calibrationreport.pdfgenerator import WasatchSinglePage
        filename = "default.pdf"
        self.assertFalse(touch_erase(filename))
        pdf = WasatchSinglePage()
        self.assertTrue(file_range(filename, 101194, ok_range=5000))

        # Generate the thumbnail of the first page
        png_filename = pdf.write_thumbnail()

        # Verify the size is as epected
        self.assertTrue(file_range(png_filename, 198863, 
                                   ok_range=40000))
예제 #3
0
    def test_fully_valid_report(self):
        from calibrationreport.models import EmptyReport
        from calibrationreport.pdfgenerator import WasatchSinglePage 

        filename = "with_images_check.pdf"
        self.assertFalse(touch_erase(filename))

        img0 = "resources/image0_defined.jpg"
        img1 = "resources/image1_defined.jpg"

        report = EmptyReport()
        report.serial = "DEFINEDSERIAL01234"
        report.coeff_0 = "1000.1213123*e-06"
        report.coeff_1 = "1001.1213123*e-06"
        report.coeff_2 = "1002.1213123*e-06"
        report.coeff_3 = "1003.1213123*e-06"
        report.top_image_filename = img0
        report.bottom_image_filename = img1
        pdf = WasatchSinglePage(filename=filename, report=report)
        self.assertTrue(file_range(filename, 106494))
예제 #4
0
 def test_filename_and_report_object_specified(self):
     from calibrationreport.pdfgenerator import WasatchSinglePage
     filename = "pdf_check.pdf"
     self.assertFalse(touch_erase(filename))
     pdf = WasatchSinglePage(filename=filename)
     self.assertTrue(file_range(filename, 101200, ok_range=5000))
예제 #5
0
 def test_all_options_unrequired(self):
     from calibrationreport.pdfgenerator import WasatchSinglePage
     filename = "default.pdf"
     self.assertFalse(touch_erase(filename))
     pdf = WasatchSinglePage()
     self.assertTrue(file_range(filename, 101200, ok_range=5000))
예제 #6
0
 def test_file_sizes_out_of_range(self):
     filename = "resources/image0_defined.jpg"
     # Too small with default range 50
     self.assertFalse(file_range(filename, 64000))
     # Too big
     self.assertFalse(file_range(filename, 61000))
예제 #7
0
 def test_file_does_not_exist(self):
     filename = "known_unknown_file"
     self.assertFalse(file_range(filename, 10000))