Mercurial > kallithea
changeset 7420:2da1689d7384
tests: small improvements to test_changeset_comments
- response checking is incorrectly placed under 'Test DB' comment
- no response check on the comment text was done
- related: use different text for the comments in different tests
- commit_id should be comment_id
- remove duplicate checking of comment count in DB
author | Thomas De Schampheleire <thomas.de_schampheleire@nokia.com> |
---|---|
date | Sat, 17 Nov 2018 21:54:21 +0100 |
parents | a6b24ff6d65c |
children | 1da20efed85f |
files | kallithea/tests/functional/test_changeset_comments.py |
diffstat | 1 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/functional/test_changeset_comments.py Thu Oct 18 22:47:25 2018 +0200 +++ b/kallithea/tests/functional/test_changeset_comments.py Sat Nov 17 21:54:21 2018 +0100 @@ -16,7 +16,7 @@ def test_create(self): self.log_user() rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' - text = u'CommentOnRevision' + text = u'general comment on changeset' params = {'text': text, '_authentication_token': self.authentication_token()} response = self.app.post(url(controller='changeset', action='comment', @@ -27,30 +27,30 @@ response = self.app.get(url(controller='changeset', action='index', repo_name=HG_REPO, revision=rev)) - # test DB - assert ChangesetComment.query().count() == 1 response.mustcontain( '''<div class="comments-number">''' ''' 1 comment (0 inline, 1 general)''' ) + response.mustcontain(text) + # test DB + assert ChangesetComment.query().count() == 1 assert Notification.query().count() == 1 - assert ChangesetComment.query().count() == 1 notification = Notification.query().all()[0] - commit_id = ChangesetComment.query().first().comment_id + comment_id = ChangesetComment.query().first().comment_id assert notification.type_ == Notification.TYPE_CHANGESET_COMMENT sbj = (u'/%s/changeset/' '27cd5cce30c96924232dffcd24178a07ffeb5dfc#comment-%s' - % (HG_REPO, commit_id)) + % (HG_REPO, comment_id)) print "%s vs %s" % (sbj, notification.subject) assert sbj in notification.subject def test_create_inline(self): self.log_user() rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' - text = u'CommentOnRevision' + text = u'inline comment on changeset' f_path = 'vcs/web/simplevcs/views/repository.py' line = 'n1' @@ -63,8 +63,6 @@ response = self.app.get(url(controller='changeset', action='index', repo_name=HG_REPO, revision=rev)) - # test DB - assert ChangesetComment.query().count() == 1 response.mustcontain( '''<div class="comments-number">''' ''' 1 comment (1 inline, 0 general)''' @@ -74,16 +72,18 @@ '''data-f_path="vcs/web/simplevcs/views/repository.py" ''' '''data-line_no="n1" data-target-id="vcswebsimplevcsviewsrepositorypy_n1">''' ) + response.mustcontain(text) + # test DB + assert ChangesetComment.query().count() == 1 assert Notification.query().count() == 1 - assert ChangesetComment.query().count() == 1 notification = Notification.query().all()[0] - commit_id = ChangesetComment.query().first().comment_id + comment_id = ChangesetComment.query().first().comment_id assert notification.type_ == Notification.TYPE_CHANGESET_COMMENT sbj = (u'/%s/changeset/' '27cd5cce30c96924232dffcd24178a07ffeb5dfc#comment-%s' - % (HG_REPO, commit_id)) + % (HG_REPO, comment_id)) print "%s vs %s" % (sbj, notification.subject) assert sbj in notification.subject @@ -102,13 +102,14 @@ response = self.app.get(url(controller='changeset', action='index', repo_name=HG_REPO, revision=rev)) - # test DB - assert ChangesetComment.query().count() == 1 response.mustcontain( '''<div class="comments-number">''' ''' 1 comment (0 inline, 1 general)''' ) + response.mustcontain('<b>@%s</b> check CommentOnRevision' % TEST_USER_REGULAR_LOGIN) + # test DB + assert ChangesetComment.query().count() == 1 assert Notification.query().count() == 2 users = [x.user.username for x in UserNotification.query().all()] @@ -118,7 +119,7 @@ def test_delete(self): self.log_user() rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc' - text = u'CommentOnRevision' + text = u'general comment on changeset to be deleted' params = {'text': text, '_authentication_token': self.authentication_token()} response = self.app.post(url(controller='changeset', action='comment', @@ -143,3 +144,4 @@ '''<div class="comments-number">''' ''' 0 comments (0 inline, 0 general)''' ) + response.mustcontain(no=text)