diff --git a/rhodecode/tests/functional/test_changeset_comments.py b/rhodecode/tests/functional/test_changeset_comments.py new file mode 100644 --- /dev/null +++ b/rhodecode/tests/functional/test_changeset_comments.py @@ -0,0 +1,143 @@ +from rhodecode.tests import * +from rhodecode.model.db import ChangesetComment, Notification, User, \ + UserNotification + +class TestChangeSetCommentrController(TestController): + + def setUp(self): + for x in ChangesetComment.query().all(): + self.Session().delete(x) + self.Session().commit() + + for x in Notification.query().all(): + self.Session().delete(x) + self.Session().commit() + + def tearDown(self): + for x in ChangesetComment.query().all(): + self.Session().delete(x) + self.Session().commit() + + for x in Notification.query().all(): + self.Session().delete(x) + self.Session().commit() + + def test_create(self): + self.log_user() + rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' + text = u'CommentOnRevision' + + params = {'text':text} + response = self.app.post(url(controller='changeset', action='comment', + repo_name=HG_REPO, revision=rev), + params=params) + # Test response... + self.assertEqual(response.status, '302 Found') + response.follow() + + response = self.app.get(url(controller='changeset', action='index', + repo_name=HG_REPO, revision=rev)) + # test DB + self.assertEqual(ChangesetComment.query().count(), 1) + self.assertTrue('''