def testGetSet(self): reporter = Reporter() reporter.setBody(self.body) reporter.setDescription(self.description) reporter.setFailMessage(self.failMessage) reporter.setCompleted(1) reporter.setUrl(self.url) reporter.setVersion(self.version) self.assertEquals(reporter.getBody(), self.body) self.assertEquals(reporter.getDescription(), self.description) self.assertEquals(reporter.getFailMessage(), self.failMessage) self.assert_(reporter.getCompleted()) self.assertEquals(reporter.getUrl(), self.url) self.assertEquals(reporter.getVersion(), self.version) # set to undef; name, version should reject reporter.setBody(None) reporter.setDescription(None) reporter.setFailMessage(None) reporter.setCompleted(None) reporter.setUrl(None) reporter.setVersion(None) self.assertEquals(reporter.getBody(), None) self.assertEquals(reporter.getDescription(), None) self.assertEquals(reporter.getFailMessage(), None) self.assert_(not reporter.getCompleted()) self.assertEquals(reporter.getUrl(), None) self.assertEquals(reporter.getVersion(), self.version) # setResult convenience method reporter.setResult(1, self.failMessage) self.assertEquals(reporter.getCompleted(), True) self.assertEquals(reporter.getFailMessage(), self.failMessage)
def testConstructor(self): # constructor with no params reporter = Reporter() self.assert_(reporter != None, 'new') self.assertEquals(reporter.getBody(), None) self.assertEquals(reporter.getDescription(), None) self.assertEquals(reporter.getFailMessage(), None) self.assertEquals(reporter.getCompleted(), False) self.assertEquals(reporter.getUrl(), None) self.assertEquals(reporter.getVersion(), '0')
def testConstructorWithParams(self): reporter = Reporter(body=self.body, completed=1, description=self.description, fail_message=self.failMessage, url=self.url, version=self.version) self.assertEquals(reporter.getBody(), self.body) self.assertEquals(reporter.getDescription(), self.description) self.assertEquals(reporter.getFailMessage(), self.failMessage) self.assert_(reporter.getCompleted()) self.assertEquals(reporter.getUrl(), self.url) self.assertEquals(reporter.getVersion(), self.version)