def load_fake(self): self.view.etherpad = fake.FakeEtherpad() self.view.embed_settings = fake.FakeEtherpadEmbedSettings() self.view.etherpad_settings = fake.FakeEtherpadSettings() self.view.portal_state = fake.FakePortalState() self.view.portal_registry = fake.FakeRegistry() self.view.padName = 'UUID03295830259' self.view.authorMapper = 'toutpt' self.view._portal = fake.FakePortal()
def test_getBasePath(self): view = EtherpadEditView(self.document, self.request) view.etherpad = fake.FakeEtherpad() view.update() # plone in mounted on / on the proxy self.subpath = '/' self.assertEqual(view._getBasePath(), '/pad/') # plone in mounted on /foo on the proxy self.subpath = '/foo' self.assertEqual(view._getBasePath(), '/foo/pad/')
def load_fake(self): self.view.etherpad = fake.FakeEtherpad() self.view.embed_settings = fake.FakeEtherpadEmbedSettings() self.view.etherpad_settings = fake.FakeEtherpadSettings() self.view.portal_state = fake.FakePortalState() self.view.portal_registry = fake.FakeRegistry() self.view.padName = 'UUID03295830259' self.view.authorMapper = 'toutpt' self.view.form_instance = fake.FakeEtherpadSyncForm() self.view._portal = fake.FakePortal() # self.view.model = fake.FakeModel self.view.dexterity_fti = fake.FakeFTI(fake.FakeModel)
def test_EtherpadSyncForm(self): form = EtherpadSyncForm(self.document, self.request) etherpad = fake.FakeEtherpad() etherpad.pads['mypad'] = {'html': 'my html'} form.padID = 'g.aDAO30LjIDJWvyTU$mypad' html = self.document.getText() self.assertEqual(html, '') form.etherpad = etherpad form.padID = 'mypad' form.field = self.document.getField('text') form.save() html = self.document.getText() self.assertEqual(html, 'my html')
def test_EtherpadSyncForm(self): form = EtherpadSyncForm(self.document, self.request) etherpad = fake.FakeEtherpad() etherpad.pads['mypad'] = {'html': 'my html'} form.padID = 'g.aDAO30LjIDJWvyTU$mypad' html = self.document.text self.assertEqual(html, None) form.etherpad = etherpad form.padID = 'mypad' from zope import component from zope import schema from plone.dexterity.interfaces import IDexterityFTI dexterity_fti = component.getUtility(IDexterityFTI, name="Document") form.field = schema.getFields(dexterity_fti.lookupSchema())['text'] form.save() html = self.document.text self.assertEqual(html.output, 'my html')
def setUp(self): super(IntegrationTestArchetypes, self).setUp() self.view = EtherpadEditView(self.document, self.request) self.view.etherpad = fake.FakeEtherpad()
def setUp(self): super(IntegrationTestEtherpadView, self).setUp() self.view = EtherpadView(self.document, self.request) self.view.etherpad = fake.FakeEtherpad()