Example #1
0
 def setUp(self):
     self.model = Mock_Model()
     self.controller = Controller(self.model)
Example #2
0
class ControllerTest(unittest.TestCase):


    def setUp(self):
        self.model = Mock_Model()
        self.controller = Controller(self.model)

    def tearDown(self):
        del self.model


    def test_initRegistering(self):
        '''
        test that controller is registered with model
        
        create our own local version just to make sure its being
        initialized the way we want.
        '''
        controller = Controller(self.model)
        self.assertTrue(controller == self.model.observer)
        
    def test_run(self):
        '''
        test run doesn't throw any exceptions.
        
        Doesn't test functionality
        '''
        self.controller.run()
        
    def test_run_raise(self):
        '''
        test that we handle the raised exception. Because reportException
        is undefined, we need to catch the NotImplementedError
        '''
        controller = Controller(Mock_Model_Raise())
        self.assertRaises(NotImplementedError, controller.run)
        
    def test_runPrevious(self):
        '''
        tests that nothing explodes
        
        @date Jul 29, 2010
        '''
        self.controller.runPrevious()
        
    def test_update(self):
        '''
        test update doesn't throw any exceptions.
        
        Doesn't test functionality
        '''
        self.controller.update()
        
    def test_getResults(self):
        '''
        Test that nothing explodes.
        '''
        self.controller.getResults()
        
    def test_reportException(self):
        self.assertRaises(NotImplementedError, self.controller.reportException, None)