예제 #1
0
    def test_secret(self):
        not_valid = (None, "", 151 * "*")
        with self.assertRaises(ValidationError):
            for s in not_valid:
                Validator.secret(s)

        self.assertIsNone(Validator.secret(30 * "*"))
예제 #2
0
    def test_secret(self):
        # We need the app context as we need to access the app config
        app = create_app(env="testing")
        app_context = app.app_context()
        app_context.push()

        not_valid = (None, "", 251 * "*")
        for s in not_valid:
            with self.assertRaises(ValidationError):
                Validator.secret(s)

        self.assertIsNone(Validator.secret(30 * "*"))