예제 #1
0
 def setUp(self):
     SeecrTestCase.setUp(self)
     ctx = CallTrace('CTX')
     tx = Transaction('TX')
     tx.locals = {'id': 'iden&tifier'}
     tx.name = "tsName"
     self.fxf = Fields2SolrDoc("tsName", "fields-partname")
     self.fxf.ctx = ctx
     self.fxf.ctx.tx = tx
     self.observer = CallTrace(methods={'add': add})
     self.fxf.addObserver(self.observer)
예제 #2
0
 def setUp(self):
     SeecrTestCase.setUp(self)
     ctx = CallTrace('CTX')
     tx = Transaction('TX')
     tx.locals = {'id': 'iden&tifier'}
     tx.name = "tsName"
     self.fxf = Fields2SolrDoc("tsName", "fields-partname")
     self.fxf.ctx = ctx
     self.fxf.ctx.tx = tx
     self.observer = CallTrace(methods={'add': add})
     self.fxf.addObserver(self.observer)
    def testEmptyNamespace(self):
        ctx = CallTrace('CTX')
        tx = Transaction('TX')
        tx.locals = {'id': 'identifier'}
        tx.name = "tsName"
        fxf = Fields2XmlFields("tsName", "fields-partname")
        fxf.ctx = ctx 
        fxf.ctx.tx = tx
        observer = CallTrace(methods={'add': add})
        fxf.addObserver(observer)
        
        fxf.begin(name='tsName')
        fxf.addField("key.sub", "value")
        list(compose(fxf.commit(tx.getId())))

        self.assertEquals(['add'], [m.name for m in observer.calledMethods])
        self.assertEqualsWS("""<fields>
                <field name="key.sub">value</field>
            </fields>""", observer.calledMethods[0].kwargs['data']) 
    def testEmptyNamespace(self):
        ctx = CallTrace('CTX')
        tx = Transaction('TX')
        tx.locals = {'id': 'identifier'}
        tx.name = "tsName"
        fxf = Fields2XmlFields("tsName", "fields-partname")
        fxf.ctx = ctx 
        fxf.ctx.tx = tx
        observer = CallTrace(methods={'add': add})
        fxf.addObserver(observer)
        
        fxf.begin(name='tsName')
        fxf.addField("key.sub", "value")
        list(compose(fxf.commit(tx.getId())))

        self.assertEqual(['add'], [m.name for m in observer.calledMethods])
        self.assertEqualsWS("""<fields>
                <field name="key.sub">value</field>
            </fields>""", observer.calledMethods[0].kwargs['data'])