コード例 #1
0
ファイル: test_util.py プロジェクト: ianthe/pybossa
 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
コード例 #2
0
ファイル: test_util.py プロジェクト: ianthe/pybossa
 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
コード例 #3
0
ファイル: validator.py プロジェクト: Skytim/pybossa
 def __call__(self, form, field):
     if is_reserved_name(self.blueprint, field.data):
         raise ValidationError(self.message)
コード例 #4
0
ファイル: validator.py プロジェクト: Save22/pybossa
 def __call__(self, form, field):
     if is_reserved_name(self.blueprint, field.data):
         raise ValidationError(self.message)
コード例 #5
0
ファイル: project.py プロジェクト: chuanchang/pybossa
 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)
コード例 #6
0
ファイル: test_util.py プロジェクト: ianthe/pybossa
 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
コード例 #7
0
ファイル: test_util.py プロジェクト: ianthe/pybossa
 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
コード例 #8
0
ファイル: test_util.py プロジェクト: ianthe/pybossa
 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
コード例 #9
0
ファイル: project.py プロジェクト: TMoneyZ/pybossa
 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)