示例#1
0
    def test_init(self):
        attachable = AttachableRef()
        attachable.Name = "test"

        self.assertEquals(attachable.LineInfo, "")
        self.assertEquals(attachable.IncludeOnSend, False)
        self.assertEquals(attachable.Inactive, False)
        self.assertEquals(attachable.NoRefOnly, False)
        self.assertEquals(attachable.EntityRef, None)
    def test_create_note(self):
        attachable = Attachable()

        vendor = Vendor.all(max_results=1, qb=self.qb_client)[0]

        attachable_ref = AttachableRef()
        attachable_ref.EntityRef = vendor.to_ref()
        attachable.AttachableRef.append(attachable_ref)

        attachable.Note = "Test note added on {}".format(self.time.strftime("%Y-%m-%d %H:%M:%S"))

        attachable.save(qb=self.qb_client)
        query_attachable = Attachable.get(attachable.Id, qb=self.qb_client)

        self.assertEquals(query_attachable.AttachableRef[0].EntityRef.value, vendor.Id)
        self.assertEquals(query_attachable.Note, "Test note added on {}".format(self.time.strftime("%Y-%m-%d %H:%M:%S")))
示例#3
0
    def test_create_note(self):
        attachable = Attachable()

        vendor = Vendor.all(max_results=1, qb=self.qb_client)[0]

        attachable_ref = AttachableRef()
        attachable_ref.EntityRef = vendor.to_ref()
        attachable.AttachableRef.append(attachable_ref)

        attachable.Note = "Test note added on {}".format(self.time.strftime("%Y-%m-%d %H:%M:%S"))

        attachable.save(qb=self.qb_client)
        query_attachable = Attachable.get(attachable.Id, qb=self.qb_client)

        self.assertEquals(query_attachable.AttachableRef[0].EntityRef.value, vendor.Id)
        self.assertEquals(query_attachable.Note, "Test note added on {}".format(self.time.strftime("%Y-%m-%d %H:%M:%S")))
示例#4
0
    def test_create_file(self):
        attachable = Attachable()

        vendor = Vendor.all(max_results=1, qb=self.qb_client)[0]

        attachable_ref = AttachableRef()
        attachable_ref.EntityRef = vendor.to_ref()
        attachable.AttachableRef.append(attachable_ref)

        attachable.FileName = 'TestFileName'
        attachable._FilePath = __file__
        attachable.ContentType = 'application/txt'

        attachable.save(qb=self.qb_client)
        query_attachable = Attachable.get(attachable.Id, qb=self.qb_client)

        self.assertEquals(query_attachable.AttachableRef[0].EntityRef.value, vendor.Id)
示例#5
0
    def test_create_file(self):
        attachable = Attachable()

        vendor = Vendor.all(max_results=1, qb=self.qb_client)[0]

        attachable_ref = AttachableRef()
        attachable_ref.EntityRef = vendor.to_ref()
        attachable.AttachableRef.append(attachable_ref)

        attachable.FileName = 'TestFileName'
        attachable._FilePath = __file__
        attachable.ContentType = 'application/txt'

        attachable.save(qb=self.qb_client)
        query_attachable = Attachable.get(attachable.Id, qb=self.qb_client)

        self.assertEquals(query_attachable.AttachableRef[0].EntityRef.value,
                          vendor.Id)
    def test_create_file(self):
        attachable = Attachable()
        test_file = tempfile.NamedTemporaryFile(suffix=".txt")

        vendor = Vendor.all(max_results=1, qb=self.qb_client)[0]

        attachable_ref = AttachableRef()
        attachable_ref.EntityRef = vendor.to_ref()
        attachable.AttachableRef.append(attachable_ref)

        attachable.FileName = os.path.basename(test_file.name)
        attachable._FilePath = test_file.name
        attachable.ContentType = 'text/plain'

        attachable.save(qb=self.qb_client)
        query_attachable = Attachable.get(attachable.Id, qb=self.qb_client)

        self.assertEquals(query_attachable.AttachableRef[0].EntityRef.value, vendor.Id)