Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 def __call__(self, form, field):
     if is_reserved_name(self.blueprint, field.data):
         raise ValidationError(self.message)
Exemplo n.º 4
0
 def __call__(self, form, field):
     if is_reserved_name(self.blueprint, field.data):
         raise ValidationError(self.message)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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
Exemplo n.º 7
0
 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
Exemplo n.º 8
0
 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
Exemplo n.º 9
0
 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)