EduploneExam/tests testResponse.py,NONE,1.1
Nils Haagen <[email protected]>
| Newsgroups | gmane.comp.web.zope.eduplone.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/eduplone/EduploneExam/tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16362/tests
Added Files:
testResponse.py
Log Message:
SimpleResponseObject modified
--- NEW FILE: testResponse.py ---
#
# Skeleton PloneTestCase
#
import os, sys
if __name__ == '__main__':
execfile(os.path.join(sys.path[0], 'framework.py'))
from Testing import ZopeTestCase
from Products.CMFPlone.tests import PloneTestCase
import common
common.installProducts()
from Products.EduploneExam.userresponses import SimpleResponse
class TestResponse(PloneTestCase.PloneTestCase):
def afterSetUp(self):
common.installWithinPortal(self.portal)
self.folder.invokeFactory('SimpleResponse', 'responseObj')
self.rObj=self.folder.responseObj
def makeQuestion(self):
self.folder.invokeFactory('MultipleChoiceQuestion', 'question')
self.qObj=self.folder.question
#testing
def testSetGetQuestion(self):
self.makeQuestion()
self.rObj.setQuestion(self.qObj)
getObj=self.rObj.getQuestion()
self.failUnless(qObj.UID()==getObj.UID())
def testGetQuestionTitle(self):
self.makeQuestion()
self.qObj.setTitle('the title')
self.rObj.setQuestion(self.qObj)
title=self.rObj.getQuestionTitle()
self.failUnless(title=='the title')
def testGetQuestionType(self):
self.makeQuestion()
self.rObj.setQuestion(self.qObj)
typ=self.rObj.getQuestionType()
self.failUnless(typ==self.qObj.getQuestionType())
def testSetResponseValues(self):
pass
def testGetResponseValues(self):
pass
def testSetGetScore(self):
self.rObj.setScore(10.5)
score=self.rObj.getScore()
self.failUnless(score==10.5)
def testGetMaxScore(self):
self.makeQuestion()
self.qObj.setMaxScore(10.2)
self.rObj.setQuestion(self.qObj)
mScore=self.rObj.getMaxScore()
self.failUnless(mScore==10.2)
#self.loginPortalOwner()
# self.failUnless(r==o['expectedValue'])
self.portal.manage_delObjects(['ExamFolder'])
def test_suite():
from unittest import TestSuite, makeSuite
suite = TestSuite()
suite.addTest(makeSuite(TestResponse))
return suite
if __name__ == '__main__':
framework()
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/