def post_calibration_report(self, post_dict): """ Convenience function to post the supplied dictionary to the request. """ from calibrationreport.views import CalibrationReportViews request = testing.DummyRequest(post_dict) inst = CalibrationReportViews(request) return inst.calibration_report()
def test_completed_form_report_created_is_accessible(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) from calibrationreport.views import CalibrationReportViews request = testing.DummyRequest() request.matchdict["serial"] = "ut5555" inst = CalibrationReportViews(request) result = inst.view_pdf() self.assertTrue(size_range(result.content_length, 106473))