def test_after_request_return_response(self): bv = BaseView() name = 'test_name' req = 'test_request' actual = bv.after_request(name, req) desired = 'test_request' self.assertEqual(actual, desired)
def test_reset_results(self): bv = BaseView() bv.results = {'key1': 'value1'} bv.reset_results() desired = { 'data': None, 'status': -1, 'error': None, 'traceback': None } self.assertDictEqual(bv.results, desired)
def test_after_request_reset_results(self): bv = BaseView() name = 'test_name' req = 'test_request' bv.after_request(name, req) desired = { 'data': None, 'status': -1, 'error': None, 'traceback': None } self.assertDictEqual(bv.results, desired)
def test_add_config(self): bv = BaseView() bv.add_config() desired = { 'data': None, 'status': -1, 'error': None, 'traceback': None, 'utahconfig': { 'release': config.release, 'mode': config.mode } } self.assertDictEqual(bv.results, desired)
def test_reset_status(self): bv = BaseView() bv.results['status'] = 42 bv.reset_status() self.assertEqual(bv.results['status'], -1)
def baseview(): baseview = BaseView() yield baseview