예제 #1
0
 def test_remove_objects(self):
     c1 = C()
     c2 = C()
     c7 = C()
     d = Container({'1': c1, '2': c2, '7': c7})
     view = EditRegistration(d, TestRequest())
     view.remove_objects(['2', '7'])
     self.assertEqual(d, {'1': c1})
예제 #2
0
    def test_registrationInfo(self):

        class V(BrowserView):
            def setPrefix(self, p):
                self._prefix = p

        ztapi.browserView(I, 'ItemEdit', V)

        c1 = C()
        c2 = C()
        c7 = C()
        d = Container({'1': c1, '2': c2, '7': c7})
        c1.__parent__ = d; c1.__name__ = '1'
        c2.__parent__ = d; c2.__name__ = '2'
        c7.__parent__ = d; c7.__name__ = '7'

        view = EditRegistration(d, TestRequest())

        info = view.registrationInfo()
        self.assertEqual(len(info), 3)
        self.assertEqual(info[0]['name'], '1')
        self.assertEqual(info[1]['name'], '2')
        self.assertEqual(info[2]['name'], '7')