EduploneTest/types EduploneTestingEnvironment.py,1.25,1.26

Nils Haagen <[email protected]> Tue, 04 Jan 2005 21:40:55 +0000
Newsgroups gmane.comp.web.zope.eduplone.cvs
Message-ID <[email protected]>
Update of /cvsroot/eduplone/EduploneTest/types
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25383/types

Modified Files:
	EduploneTestingEnvironment.py 
Log Message:
TestingEnv with populate-function

Index: EduploneTestingEnvironment.py
===================================================================
RCS file: /cvsroot/eduplone/EduploneTest/types/EduploneTestingEnvironment.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** EduploneTestingEnvironment.py	3 Jan 2005 13:13:28 -0000	1.25
--- EduploneTestingEnvironment.py	4 Jan 2005 21:40:39 -0000	1.26
***************
*** 742,745 ****
--- 742,778 ----
  
  
+     def populateTest(self):
+         """ for testing; pre-populates the test with 
+             a lot of nice questions, answers and users ....."""
+ 
+         from Products.EduploneTest.population_data import *
+ 
+         for question in testValues:
+             self.invokeFactory(''.join(['eduplone ', question['type']]), 
+                                id=question['title'], 
+                                title=question['title'])
+                                
+             for field in question['param']:
+                 mutator=self[question['title']].getField(field).getMutator(self[question['title']])
+                 mutator(question['param'][field])
+                                
+             for answer in question['answers']:
+                 answerNumber=len(self[question['title']].contentValues())
+                 answerId=''.join(['Answer',str(answerNumber)])
+                 self[question['title']].invokeFactory(
+                                      ''.join(['eduplone ', question['type'], 'Answer']), 
+                                      id=answerId)
+                                      
+                 answerObj=self[question['title']][answerId]
+                 for field in answer:
+                     print answerObj.getField(field)
+                     mutator=answerObj.getField(field).getMutator(answerObj)
+                     
+                     mutator(answer[field])
+                     
+ 
+         return 'done.'
+         
+ 
  
  modify_fti = utils.modify_fti



-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt