class HandlerValidatorTestCase(unittest.TestCase):
    def setUp(self):
        super(HandlerValidatorTestCase, self).setUp()
        self.validator = HandlerValidator()

    def test_check_handler(self):
        valid_handler = MethodBasedView
        self.assertIsNone(self.validator.validate(valid_handler))

    def test_check_handler_failed(self):
        invalid_handler = object
        self.assertRaises(InvalidHandler, self.validator.validate,
                          invalid_handler)

    def test_check_handler_failed_2(self):
        invalid_handler = [
            'not a class',
        ]
        self.assertRaises(InvalidHandler, self.validator.validate,
                          invalid_handler)
Exemple #2
0
class HandlerValidatorTestCase(unittest.TestCase):

    def setUp(self):
        super(HandlerValidatorTestCase, self).setUp()
        self.validator = HandlerValidator()

    def test_check_handler(self):
        valid_handler = MethodBasedView
        self.assertIsNone(self.validator.validate(valid_handler))

    def test_check_handler_failed(self):
        invalid_handler = object
        self.assertRaises(
            InvalidHandler,
            self.validator.validate, invalid_handler
        )

    def test_check_handler_failed_2(self):
        invalid_handler = ['not a class', ]
        self.assertRaises(
            InvalidHandler,
            self.validator.validate, invalid_handler
        )
 def setUp(self):
     super(HandlerValidatorTestCase, self).setUp()
     self.validator = HandlerValidator()
Exemple #4
0
 def setUp(self):
     super(HandlerValidatorTestCase, self).setUp()
     self.validator = HandlerValidator()