def setUp(self):
        p = Policy()
        p.set("foo", "bar")
        p.set("count", 3)
        p.set("files", "goob")
        p.add("files", "gurn")
        impl = bb.PolicyBlackboardItem()
        impl._props = p
        self.bbi = bb.ImplBlackboardItem(impl)

        self.initCount = 3
    def testCopyFrom(self):
        # create empty item
        bbi = bb.PolicyBlackboardItem()
        self.assertEquals(len(bbi.getPropertyNames()), 0)

        # test copy
        bbi._copyFrom(self.bbi)
        self.assertEquals(len(bbi.getPropertyNames()), 3)
        self.assertEquals(bbi.getProperty("foo"), "bar")

        # test that copy doesn't affect original
        bbi._setProperty("foo", "hank")
        self.assertEquals(bbi.getProperty("foo"), "hank")
        self.assertEquals(self.bbi.getProperty("foo"), "bar")
    def setUp(self):
        if not os.path.exists(self.propfile):
            p = Policy()
            p.set("foo", "bar")
            p.set("count", 3)
            p.set("files", "goob")
            p.add("files", "gurn")
            w = PAFWriter(self.propfile)
            w.write(p, True)
            w.close()

        self.bbi = bb.PolicyBlackboardItem(self.propfile)

        self.initCount = 3
 def testEmptyCtr(self):
     # overriding DictBBItemTestCase
     bbi = bb.PolicyBlackboardItem()
     self.assertEquals(len(bbi.getPropertyNames()), 0)
 def _newItem(self, data=None):
     out = bb.PolicyBlackboardItem()
     if data:
         for key in data.keys():
             out._setProperty(key, data[key])
     return out