[Zope-CMF] Re: CMFTestCase: Best way to create the CMF site?

2005-10-05 Thread Stefan H. Holek

I see two options:

a) Use a different portal name

portal_name = 'mysite'
CMFTestCase.setupCMFSite(portal_name)

b) Use getPortal() to create a new portal per test

def getPortal(self):
manage_addCMFSite(self.app, portal_name)
return getattr(self.app, portal_name)

Stefan


On 5. Okt 2005, at 01:08, Paul Winkler wrote:


At one time, I naively had it set up in getPortal() but that seems
to have worked only in one product and only by bizarre coincidence  
as it

failed in every other product test I tried it with.
(Random assortment of BadRequest and ReadConflictErrors, I was
never able to sort it all out.) So that seems unlikely to be the Right
Thing (tm).


--
Anything that happens, happens.  --Douglas Adams


___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


[Zope-CMF] CMF Collector: Open Issues

2005-10-05 Thread tseaver
The following supporters have open issues assigned to them in this collector
(http://www.zope.org/Collectors/CMF).

Assigned and Open


  efge

- CMFSetup: provide non-ascii im- and exports,
  [Accepted] http://www.zope.org/Collectors/CMF/292

- CMFSetup doesn't correctly detect DCWorkflow on export,
  [Accepted] http://www.zope.org/Collectors/CMF/298


  jens

- FSPropertiesObject.py cannot handle multiline input for lines, text 
attributes,
  [Accepted] http://www.zope.org/Collectors/CMF/271


  mhammond

- Windows DevelopmentMode penalty in CMFCore.DirectoryView,
  [Accepted] http://www.zope.org/Collectors/CMF/366


  mj

- CMFSetup doesn't correctly detect DCWorkflow on export,
  [Accepted] http://www.zope.org/Collectors/CMF/298


Pending / Deferred Issues

- CMFCalendar weekday locale issue,
  [Pending] http://www.zope.org/Collectors/CMF/237

- Wrong cache association for FSObject,
  [Pending] http://www.zope.org/Collectors/CMF/255

- CMFSetup: Windows exports contain CR/LF, LF and even CR newlines,
  [Pending] http://www.zope.org/Collectors/CMF/266

- PortalCatalog.ZopeFindAndApply should probably also search in 
opaqueItems,
  [Pending] http://www.zope.org/Collectors/CMF/296

- WorkflowTool should recurse into opaqueItems,
  [Pending] http://www.zope.org/Collectors/CMF/297

- add External Methods to workflow script handling,
  [Pending] http://www.zope.org/Collectors/CMF/329

- Can't invalidate skin items in a RAMCacheManager,
  [Pending] http://www.zope.org/Collectors/CMF/343

- CMFSetup: Workflow Tool export fails with workflows which have scripts,
  [Pending] http://www.zope.org/Collectors/CMF/373

- CMFCore.Skinnable.SkinnableObjectManager can merge skin data,
  [Pending] http://www.zope.org/Collectors/CMF/375

- Proxy Roles does't work for a Script using portal_catalog.searchResults,
  [Pending] http://www.zope.org/Collectors/CMF/380

- WorkflowAction deprecated warning should not printed for WorkflowMethod,
  [Pending] http://www.zope.org/Collectors/CMF/388


Pending / Deferred Features

- Favorite.py: queries and anchors in remote_url,
  [Pending] http://www.zope.org/Collectors/CMF/26

- Allow flexible date editing in Event.py (CMFCalendar),
  [Pending] http://www.zope.org/Collectors/CMF/40

- DefaultDublinCore should have Creator property,
  [Pending] http://www.zope.org/Collectors/CMF/61

- Make changeFromProperties accept sequences too,
  [Pending] http://www.zope.org/Collectors/CMF/99

- path criteria on Topic should honor VHM,
  [Pending] http://www.zope.org/Collectors/CMF/111

- Document.py: universal newlines,
  [Pending] http://www.zope.org/Collectors/CMF/174

- Permissions in PortalFolder: invokeFactory(),
  [Pending] http://www.zope.org/Collectors/CMF/175

- Add condition for transition's action like other action,
  [Pending] http://www.zope.org/Collectors/CMF/207

- Major action enhancement,
  [Pending] http://www.zope.org/Collectors/CMF/232

- portal_type is undefined in initialization code,
  [Pending] http://www.zope.org/Collectors/CMF/248

- Action._listsActions() should be more safe,
  [Pending] http://www.zope.org/Collectors/CMF/253

- Expose Document text_format metadata,
  [Pending] http://www.zope.org/Collectors/CMF/285

- customization of type of homefolder on creation,
  [Pending] http://www.zope.org/Collectors/CMF/288

- Allow contentFilter to use review_state,
  [Pending] http://www.zope.org/Collectors/CMF/294

- CMFTopic Does Not Cache,
  [Pending] http://www.zope.org/Collectors/CMF/295

- Wishlist: a flag that tags the selected action.,
  [Pending] http://www.zope.org/Collectors/CMF/301

- CMFDefault should make use of allowCreate(),
  [Pending] http://www.zope.org/Collectors/CMF/340

- Nested Skins,
  [Pending] http://www.zope.org/Collectors/CMF/377

- CatalogVariableProvider code + tests,
  [Pending] http://www.zope.org/Collectors/CMF/378

- manage_doCustomize() : minor additions,
  [Pending] http://www.zope.org/Collectors/CMF/382



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Re: CMFTestCase: Best way to create the CMF site?

2005-10-05 Thread Chris Withers

Stefan H. Holek wrote:

I see two options:

a) Use a different portal name

portal_name = 'mysite'
CMFTestCase.setupCMFSite(portal_name)


Can setupCMFSite not do something more clever if it finds the object 
already there?



b) Use getPortal() to create a new portal per test

def getPortal(self):
manage_addCMFSite(self.app, portal_name)
return getattr(self.app, portal_name)


hahaha, and watch your tests take hours to run ;-)

Chris

--
Simplistix - Content Management, Zope  Python Consulting
   - http://www.simplistix.co.uk

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Re: CMFTestCase: Best way to create the CMF site?

2005-10-05 Thread Lennart Regebro
On 10/5/05, Chris Withers [EMAIL PROTECTED] wrote:
 Stefan H. Holek wrote:
  I see two options:
 
  a) Use a different portal name
 
  portal_name = 'mysite'
  CMFTestCase.setupCMFSite(portal_name)

 Can setupCMFSite not do something more clever if it finds the object
 already there?

  b) Use getPortal() to create a new portal per test
 
  def getPortal(self):
  manage_addCMFSite(self.app, portal_name)
  return getattr(self.app, portal_name)

 hahaha, and watch your tests take hours to run ;-)

 Chris

Any test including PortalTestCase should really not be seen as a unit
test, but a fucntional test. ;) If we could put in some effort of
making a minimal dymmy-portal that can be deleted and recreated very
quickly, then that would be very interesting. I would assume that that
involved a lot of work though...
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Re: CMFTestCase: Best way to create the CMF site?

2005-10-05 Thread Paul Winkler
Lennart Regebro said:
 On 10/5/05, Chris Withers [EMAIL PROTECTED] wrote:
 Stefan H. Holek wrote:
  I see two options:
 
  a) Use a different portal name
 
  portal_name = 'mysite'
  CMFTestCase.setupCMFSite(portal_name)

 Can setupCMFSite not do something more clever if it finds the object
 already there?

It simply doesn't do anything in that case.

  b) Use getPortal() to create a new portal per test
 
  def getPortal(self):
  manage_addCMFSite(self.app, portal_name)
  return getattr(self.app, portal_name)

 hahaha, and watch your tests take hours to run ;-)

Maybe that way, but setupCMFSite() is pretty quick.

 Any test including PortalTestCase should really not be seen as a unit
 test, but a fucntional test. ;)

Regardless of which, we still need to run it :)

 If we could put in some effort of
 making a minimal dymmy-portal that can be deleted and recreated very
 quickly, then that would be very interesting. I would assume that that
 involved a lot of work though...

CMFTestCase's setupCMFSite() is already pretty quick.

-- 
Paul Winkler
http://www.slinkp.com



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


[Zope-CMF] Testing skin scripts and templates using ZopeTestCase.Functional

2005-10-05 Thread Paul Winkler
Hi again :)
I'm trying to use CMFTestCase along with ZopeTestCase.Functional
to test my skin scripts.  But how do I get them set up
properly? Anybody have working examples of this?  I wondered
if there might be some in the Plone test suites but if so I
didn't find any.

Example that fails because document_view is 404:

class TestUI(CMFTestCase.CMFTestCase,
 ZopeTestCase.FunctionalTestCase,
 ):

Test the skin scripts and templates.


def getPortal(self):
# Set up a CMF site.
setupCMFSite(app=self.app)
return getattr(self.app, CMFTestCase.portal_name)

def afterSetUp(self):
self.basic_auth = '%s:%s' % (user_name, user_password)
self.setRoles(['Manager', 'Member'])
# Add a folder and a doc.
self.portal.invokeFactory(type_name='Folder', id='folder1')
self.fol1 = self.portal.folder1
data = 'Testing ZSyncer Tool, blah blah blah'
self.fol1.invokeFactory('Document', 'test_doc1',
title='nunya bizness',
text=data)
self.doc1 = self.fol1.test_doc1

def test_DocView(self):
url = self.doc1.absolute_url_path()
import pdb; pdb.set_trace()
response = self.publish(url, self.basic_auth)


Some stepping around with pdb reveals this:

(Pdb) n
 /zope/ZopeSoftwareHome/lib/python/ZPublisher/Publish.py(101)publish()
- request, bind=1)
(Pdb) n
NotFound: 'document_view'

-- 
Paul Winkler
http://www.slinkp.com



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Testing skin scripts and templates using ZopeTestCase.Functional

2005-10-05 Thread Jens Vagelpohl

def test_DocView(self):
url = self.doc1.absolute_url_path()
import pdb; pdb.set_trace()
response = self.publish(url, self.basic_auth)


Some stepping around with pdb reveals this:

(Pdb) n


/zope/ZopeSoftwareHome/lib/python/ZPublisher/Publish.py(101)publish()


- request, bind=1)
(Pdb) n
NotFound: 'document_view'


The machinery doesn't know which skin is selected I presume. You can  
force it by calling changeSkin on the skinnable object manager  
(the portal is one) to select a skin path as set up in the skins tool:


self.portal.changeSkin('Nouvelle')

jens

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


[Zope-CMF] Re: Mixing ZopeTestCase.Sandboxed and CMFTestCase?

2005-10-05 Thread Paul Winkler
Answering my own post, I just discovered something else:

Paul Winkler said:
 It mostly seems to work, but as far as I can tell, you *must*
 inherit in exactly that order, i.e.

 class MyTest(ZopeTestCase.Sandboxed, CMFTestCase.CMFTestCase):

As it turns out, even with my modification to setupCMFSite(),
you really *want* to inherit in this order anyway.
If you don't, Sandboxed doesn't seem to do any good.
i.e. if you inherit in that order, you will avoid polluting
the ZODB after the test suite finishes.  (At least that
seems to be the case from some quick experimentation, and
AFAICT that's the intended purpose of Sandboxed, right?)

If you inherit in the other order, e.g.
class Foo(CMFTestCase.CMFTestCase, ZopeTestCase.Sandboxed),
then you have to be sure you've deleted anything
that might still be around in beforeTearDown().
So I guess in that case there's no point in inheriting
from Sandboxed.

-- 
Paul Winkler
http://www.slinkp.com



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Testing skin scripts and templates using ZopeTestCase.Functional

2005-10-05 Thread Paul Winkler
Jens Vagelpohl said:
 def test_DocView(self):
 url = self.doc1.absolute_url_path()
 import pdb; pdb.set_trace()
 response = self.publish(url, self.basic_auth)


 Some stepping around with pdb reveals this:
 
 (Pdb) n

 /zope/ZopeSoftwareHome/lib/python/ZPublisher/Publish.py(101)publish()

 - request, bind=1)
 (Pdb) n
 NotFound: 'document_view'

 The machinery doesn't know which skin is selected I presume. You can
 force it by calling changeSkin on the skinnable object manager
 (the portal is one) to select a skin path as set up in the skins tool:

 self.portal.changeSkin('Nouvelle')

That may well be necessary, but it's evidently not sufficient :-)
Any other ideas?  Meanwhile, it's more time in the debugger for me...
Hmm, now that I think about it, I seem to recall that skin objects
aren't acquired when I'm poking around in zopectl debug either.
Presumably it's the same problem.

I had a look at the tests for CMFCore and CMFDefault, but there don't
seem to be any tests for SkinnableObjectManager at all.
Ouch!


-- 
Paul Winkler
http://www.slinkp.com



___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Testing skin scripts and templates using ZopeTestCase.Functional

2005-10-05 Thread Jens Vagelpohl


On 5 Oct 2005, at 23:07, Paul Winkler wrote:

- request, bind=1)
(Pdb) n
NotFound: 'document_view'



The machinery doesn't know which skin is selected I presume. You can
force it by calling changeSkin on the skinnable object manager
(the portal is one) to select a skin path as set up in the skins  
tool:


self.portal.changeSkin('Nouvelle')



That may well be necessary, but it's evidently not sufficient :-)
Any other ideas?  Meanwhile, it's more time in the debugger for me...
Hmm, now that I think about it, I seem to recall that skin objects
aren't acquired when I'm poking around in zopectl debug either.
Presumably it's the same problem.


This specific condition (skin objects not found when in zopectl debug  
or when testing) has *always* been remedied for me by calling  
changeSkin...


jens

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


[Zope-CMF] Re: Testing skin scripts and templates using ZopeTestCase.Functional

2005-10-05 Thread Stefan H. Holek

On 5. Okt 2005, at 23:27, Paul Winkler wrote:


I'm trying to use CMFTestCase along with ZopeTestCase.Functional
to test my skin scripts.  But how do I get them set up
properly? Anybody have working examples of this?  I wondered
if there might be some in the Plone test suites but if so I
didn't find any.

Example that fails because document_view is 404:

class TestUI(CMFTestCase.CMFTestCase,
 ZopeTestCase.FunctionalTestCase,
 ):

Test the skin scripts and templates.



This should be

class TestUI(ZopeTestCase.Functional, CMFTestCase.CMFTestCase):

or even

class TestUI(CMFTestCase.FunctionalTestCase):

Your observation (in one of the other mails wink) is correct. Mix- 
ins must come first. Also, make sure to use the SVN version of  
CMFTestCase [1] as the tarball is outdated.


Stefan


[1] https://svn.plone.org/svn/collective/CMFTestCase/trunk

--
Anything that happens, happens.  --Douglas Adams


___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] Testing skin scripts and templates using ZopeTestCase.Functional

2005-10-05 Thread Tom Dossis

Paul Winkler wrote:

Hi again :)
I'm trying to use CMFTestCase along with ZopeTestCase.Functional
to test my skin scripts.  But how do I get them set up
properly? Anybody have working examples of this?  I wondered
if there might be some in the Plone test suites but if so I
didn't find any.

Example that fails because document_view is 404:

class TestUI(CMFTestCase.CMFTestCase,
 ZopeTestCase.FunctionalTestCase,
 ):

Test the skin scripts and templates.


def getPortal(self):
# Set up a CMF site.
setupCMFSite(app=self.app)
return getattr(self.app, CMFTestCase.portal_name)

def afterSetUp(self):
self.basic_auth = '%s:%s' % (user_name, user_password)
self.setRoles(['Manager', 'Member'])
# Add a folder and a doc.
self.portal.invokeFactory(type_name='Folder', id='folder1')
self.fol1 = self.portal.folder1
data = 'Testing ZSyncer Tool, blah blah blah'
self.fol1.invokeFactory('Document', 'test_doc1',
title='nunya bizness',
text=data)
self.doc1 = self.fol1.test_doc1

def test_DocView(self):
url = self.doc1.absolute_url_path()
import pdb; pdb.set_trace()
response = self.publish(url, self.basic_auth)


Some stepping around with pdb reveals this:

(Pdb) n

/zope/ZopeSoftwareHome/lib/python/ZPublisher/Publish.py(101)publish()

- request, bind=1)
(Pdb) n
NotFound: 'document_view'



Maybe adding the following in afterSetUp() will help.

self._refreshSkinData()


-Tom
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests