class DataToFieldTest(SeecrTestCase):
    def setUp(self):
        SeecrTestCase.setUp(self)
        self.data2field = DataToField(fromKwarg='data', fieldname='field')
        self.observer = CallTrace('Observer')
        self.data2field.addObserver(self.observer)

    def testAdd(self):
        lico(self.data2field.add(identifier='identifier', partname='part', data='somedata'))
        self.assertEquals(['addField'], [m.name for m in self.observer.calledMethods])
        self.assertEquals(dict(name='field', value='somedata'), self.observer.calledMethods[0].kwargs)
        
    def testAddWithoutFromKwarg(self):
        self.data2field.add(identifier='identifier', partname='part', lxmlNode='somedata')
        self.assertEquals([], [m.name for m in self.observer.calledMethods])
 def setUp(self):
     SeecrTestCase.setUp(self)
     self.data2field = DataToField(fromKwarg='data', fieldname='field')
     self.observer = CallTrace('Observer')
     self.data2field.addObserver(self.observer)