Exemplo n.º 1
0
    def test_batch_error(self):
        fobj = self.find_group(self.gid)

        con0 = GCContact(fobj)
        con0.set_firstname('Namo Narayananaya')
        gce0 = con0.get_gce()

        con = GCContact(fobj)
        con.set_firstname('Ayeshwarya')
        con.set_birthday('abcd"ef')
        # con.set_anniv('1978-05-31 %s est n il y a %d ans')
        # con.set_birthday('1980-08-10')
        gce = con.get_gce()

        feed = self.pimdb.new_feed()
        feed.add_insert(entry=gce0, batch_id_string="DeadBeef")
        feed.add_insert(entry=gce0, batch_id_string="DeadBeef")
        feed.add_insert(entry=gce, batch_id_string="DeadBeef")

        b = BatchState(1, feed, op='insert', sync_tag="asynk:testgcex:ex")

        print 'Request: ', utils.pretty_xml(str(feed))
        rr = self.pimdb.exec_batch(feed)
        print 'Response: ', utils.pretty_xml(str(rr))

        for entry in rr.entry:
            print entry.batch_status
            if entry.batch_status:
                print 'Code: ', entry.batch_status.code
                print 'Reason: ', entry.batch_status.reason
            else:
                self.handle_interrupted_feed(feed, str(rr))
Exemplo n.º 2
0
    def test_batch_error (self):
        fobj = self.find_group(self.gid)

        con0 = GCContact(fobj)
        con0.set_firstname('Namo Narayananaya')
        gce0 = con0.get_gce()

        con = GCContact(fobj)
        con.set_firstname('Ayeshwarya')
        con.set_birthday('abcd"ef')
        # con.set_anniv('1978-05-31 %s est n il y a %d ans')
        # con.set_birthday('1980-08-10')
        gce = con.get_gce()

        feed = self.pimdb.new_feed()
        feed.add_insert(entry=gce0, batch_id_string="DeadBeef")
        feed.add_insert(entry=gce0, batch_id_string="DeadBeef")
        feed.add_insert(entry=gce, batch_id_string="DeadBeef")

        b = BatchState(1, feed, op='insert', sync_tag="asynk:testgcex:ex")

        print 'Request: ', utils.pretty_xml(str(feed))
        rr = self.pimdb.exec_batch(feed)
        print 'Response: ', utils.pretty_xml(str(rr))

        for entry in rr.entry:
            print entry.batch_status
            if entry.batch_status:
                print 'Code: ',entry.batch_status.code
                print 'Reason: ', entry.batch_status.reason
            else:
                self.handle_interrupted_feed(feed, str(rr))