def test_returns_true_for_reserved_name_for_account_blueprint(self): with self.app.app_context(): reserved = util.is_reserved_name('account', 'register') assert reserved is True, reserved reserved = util.is_reserved_name('account', 'forgot-password') assert reserved is True, reserved reserved = util.is_reserved_name('account', 'profile') assert reserved is True, reserved reserved = util.is_reserved_name('account', 'signin') assert reserved is True, reserved reserved = util.is_reserved_name('account', 'reset-password') assert reserved is True, reserved
def test_returns_true_for_reserved_name_for_app_blueprint(self): with self.app.app_context(): reserved = util.is_reserved_name('project', 'new') assert reserved is True, reserved reserved = util.is_reserved_name('project', 'category') assert reserved is True, reserved reserved = util.is_reserved_name('project', 'page') assert reserved is True, reserved reserved = util.is_reserved_name('project', 'draft') assert reserved is True, reserved reserved = util.is_reserved_name('project', 'published') assert reserved is True, reserved
def __call__(self, form, field): if is_reserved_name(self.blueprint, field.data): raise ValidationError(self.message)
def _validate_instance(self, project): if project.short_name and is_reserved_name('project', project.short_name): msg = "Project short_name is not valid, as it's used by the system." raise ValueError(msg)
def test_returns_false_for_empty_name_string(self): with self.app.app_context(): reserved = util.is_reserved_name('account', '') assert reserved is False, reserved
def test_returns_false_for_valid_name_for_account_blueprint(self): with self.app.app_context(): reserved = util.is_reserved_name('account', 'fulanito') assert reserved is False, reserved reserved = util.is_reserved_name('acount', 'profileFulanito') assert reserved is False, reserved
def test_returns_false_for_valid_name_for_app_blueprint(self): with self.app.app_context(): reserved = util.is_reserved_name('project', 'test_project') assert reserved is False, reserved reserved = util.is_reserved_name('project', 'newProject') assert reserved is False, reserved