示例#1
0
    def test_removing_pdf(self):
        attachment = Attachment(filename="sample.pdf", object_name="sample")
        to = TaskOrder(pdf=attachment)
        assert to.pdf is not None

        to.pdf = ""
        assert to.pdf is None
示例#2
0
    def test_setting_pdf_with_empty_value(self):
        to = TaskOrder()
        assert to.pdf is None

        to.pdf = ""
        assert to.pdf is None
示例#3
0
 def test_setting_pdf_with_dictionary(self):
     to = TaskOrder()
     to.pdf = {"filename": PDF_FILENAME, "object_name": "123456"}
     assert to.pdf is not None
     assert to.pdf.filename == PDF_FILENAME
示例#4
0
 def test_setting_pdf_with_invalid_object(self):
     to = TaskOrder()
     with pytest.raises(TypeError):
         to.pdf = "invalid"
示例#5
0
    def test_setting_pdf_with_attachment(self):
        to = TaskOrder()
        attachment = Attachment(filename="sample.pdf", object_name="sample")
        to.pdf = attachment

        assert to.pdf_attachment_id == attachment.id