def createView(self, obj): view = ZodbInfoView(obj, TestRequest()) view.obj = obj view.state = ZodbObjectStateStub(view.obj) view.requestedTid = None view.getRootOid = lambda: 1 return view
def createView(self, obj): view = ZodbInfoView(obj, TestRequest()) view.obj = obj view.state = ZodbObjectStateStub(view.obj) view.requestedTid = None view.getRootOid = lambda: 1 return view
def test_getDisassembledPickleData(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.pickledState = b'' self.assertEqual( view.getDisassembledPickleData(), 'ValueError: pickle exhausted before seeing STOP\n\n' 'ValueError: pickle exhausted before seeing STOP\n')
def test_listItems(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.requestedTid = 42 view.state.listItems = lambda: [('zoinks', 17), ('scoobysnack', None)] self.assertEquals(view.listItems(), [ZodbObjectAttribute('zoinks', 17, 42), ZodbObjectAttribute('scoobysnack', None, 42)])
def test_listItems(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.requestedTid = 42 view.state.listItems = lambda: [('zoinks', 17), ('scoobysnack', None)] self.assertEqual(view.listItems(), [ ZodbObjectAttribute('zoinks', 17, 42), ZodbObjectAttribute('scoobysnack', None, 42) ])
def test_listItems_none_exist(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.listItems = lambda: None self.assertEquals(view.listItems(), None)
def test_listItems_empty(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.listItems = lambda: [] self.assertEquals(view.listItems(), [])
def test_listAttributes_none_exist(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.requestedTid = 42 view.state.listAttributes = lambda: None self.assertEquals(view.listAttributes(), None)
def test_listItems_none_exist(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.listItems = lambda: None self.assertEqual(view.listItems(), None)
def test_listItems_empty(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.listItems = lambda: [] self.assertEqual(view.listItems(), [])
def test_listAttributes_none_exist(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.requestedTid = 42 view.state.listAttributes = lambda: None self.assertEqual(view.listAttributes(), None)
def test_listAttributes_empty(self): view = ZodbInfoView(None, None) view.state = ZodbObjectStateStub(PersistentStub()) view.state.requestedTid = 42 view.state.listAttributes = lambda: [] self.assertEqual(view.listAttributes(), [])