def test_infos(self, getToolByName): from collective.cart.shopping.interfaces import ICustomerInfo adapter = IMember(self.portal) getToolByName().getHomeFolder().getPhysicalPath.return_value = ['', 'path'] adapter.get_brains = mock.Mock() adapter.infos() adapter.get_brains.assert_called_with(ICustomerInfo, path='/path', depth=1)
def test_rest_of_infos(self, getToolByName): adapter = IMember(self.portal) info1 = mock.Mock() info1.UID = 'uuid1' info2 = mock.Mock() info2.UID = 'uuid2' info3 = mock.Mock() info3.UID = 'uuid3' adapter.get_brains = mock.Mock(return_value=[info1, info2, info3]) self.assertEqual(adapter.rest_of_infos('uuid1'), [info2, info3]) self.assertEqual(adapter.rest_of_infos('uuid2'), [info1, info3]) self.assertEqual(adapter.rest_of_infos('uuid3'), [info1, info2])