def test_publishTraverse_factory(self): factory = Factory() ztapi.provideUtility(IFactory, factory, 'foo') container = Container() request = TestRequest() adding = Adding(container, request) self.assert_(adding.publishTraverse(request, 'foo') is factory)
def testNoNameGiven(self): container = Container() request = TestRequest() adding = Adding(container, request) ztapi.browserView(IAdding, "Thing", CreationView) self.assertEqual(adding.contentName, None) view = adding.publishTraverse(request, 'Thing=') self.assertEqual(adding.contentName, '')
def test(self): container = Container() request = TestRequest() adding = Adding(container, request) ztapi.browserView(IAdding, "Thing", CreationView) self.assertEqual(adding.contentName, None) view = adding.publishTraverse(request, 'Thing=foo') self.assertEqual(view.action(), 'been there, done that') self.assertEqual(adding.contentName, 'foo') o = object() result = adding.add(o) # Check the state of the container and result self.assertEqual(container["foo"], o) self.assertEqual(result, o)