##// END OF EJS Templates
Add test for NotReviewed validator
marcink -
r2721:36915dd4 beta
parent child Browse files
Show More
@@ -10,6 +10,9 b' from rhodecode.model.users_group import '
10 10 from rhodecode.model.meta import Session
11 11 from rhodecode.model.repos_group import ReposGroupModel
12 12 from rhodecode.config.routing import ADMIN_PREFIX
13 from rhodecode.model.db import ChangesetStatus
14 from rhodecode.model.changeset_status import ChangesetStatusModel
15 from rhodecode.model.comment import ChangesetCommentsModel
13 16
14 17
15 18 class TestReposGroups(unittest.TestCase):
@@ -222,3 +225,22 b' class TestReposGroups(unittest.TestCase)'
222 225 def test_AttrLoginValidator(self):
223 226 validator = v.AttrLoginValidator()
224 227 self.assertRaises(formencode.Invalid, validator.to_python, 123)
228
229 def test_NotReviewedRevisions(self):
230 validator = v.NotReviewedRevisions()
231 rev = '0' * 40
232 # add status for a rev, that should throw an error because it is already
233 # reviewed
234 new_status = ChangesetStatus()
235 new_status.author = ChangesetStatusModel()._get_user(TEST_USER_ADMIN_LOGIN)
236 new_status.repo = ChangesetStatusModel()._get_repo(HG_REPO)
237 new_status.status = ChangesetStatus.STATUS_APPROVED
238 new_status.comment = None
239 new_status.revision = rev
240 Session().add(new_status)
241 Session().commit()
242 try:
243 self.assertRaises(formencode.Invalid, validator.to_python, [rev])
244 finally:
245 Session().delete(new_status)
246 Session().commit()
General Comments 0
You need to be logged in to leave comments. Login now