def test_event_dispatched_to_sublocation_should_be_ignored(self): # XXX: I'm not quite sure which use cases actually create this kind of # ObjectAddedEvent, but we've inherited this guard from zeit.solr and # they probably had a good reason. %-) content = ExampleContentType() content.uniqueId = 'xzy://bla/fasel' content_sub = ExampleContentType() content_sub.uniqueId = 'xzy://bla/fasel/sub' event = zope.lifecycleevent.ObjectAddedEvent(content) for ignored in zope.component.subscribers((content_sub, event), None): pass self.assertFalse(self.tms.index.called)
def test_returns_html_and_plain_text(self): content = ExampleContentType() content.uniqueId = 'http://xml.zeit.de/foo/bar' renderer = Renderer('http://localhost:%s' % self.layer['http_port']) result = renderer(content) self.assertEqual('html', result['html']) self.assertEqual('txt', result['text'])
def test_host_with_trailing_slash_yields_correct_url(self): content = ExampleContentType() content.uniqueId = 'http://xml.zeit.de/foo/bar' renderer = Renderer('http://example.com:8080/') self.assertEqual('http://example.com:8080/foo/bar', renderer.url(content))
def test_converts_uniqueId_to_rendering_host(self): content = ExampleContentType() content.uniqueId = 'http://xml.zeit.de/foo/bar' renderer = Renderer('http://example.com:8080') self.assertEqual('http://example.com:8080/foo/bar', renderer.url(content))