##// END OF EJS Templates
tests: added some additional tests for commit comments....
marcink -
r536:eaeba764 default
parent child Browse files
Show More
@@ -29,7 +29,7 b' from rhodecode.lib import helpers as h'
29
29
30
30
31 @pytest.mark.backends("git", "hg", "svn")
31 @pytest.mark.backends("git", "hg", "svn")
32 class TestChangeSetCommentsController(TestController):
32 class TestCommitCommentsController(TestController):
33
33
34 @pytest.fixture(autouse=True)
34 @pytest.fixture(autouse=True)
35 def prepare(self, request, pylonsapp):
35 def prepare(self, request, pylonsapp):
@@ -160,6 +160,46 b' class TestChangeSetCommentsController(Te'
160 # test_regular gets notification by @mention
160 # test_regular gets notification by @mention
161 assert sorted(users) == [u'test_admin', u'test_regular']
161 assert sorted(users) == [u'test_admin', u'test_regular']
162
162
163 def test_create_with_status_change(self, backend):
164 self.log_user()
165 commit = backend.repo.get_commit('300')
166 commit_id = commit.raw_id
167 text = u'CommentOnCommit'
168 f_path = 'vcs/web/simplevcs/views/repository.py'
169 line = 'n1'
170
171 params = {'text': text, 'changeset_status': 'approved',
172 'csrf_token': self.csrf_token}
173
174 self.app.post(
175 url(controller='changeset', action='comment',
176 repo_name=backend.repo_name, revision=commit_id), params=params)
177
178 response = self.app.get(
179 url(controller='changeset', action='index',
180 repo_name=backend.repo_name, revision=commit_id))
181
182 # test DB
183 assert ChangesetComment.query().count() == 1
184 assert_comment_links(response, ChangesetComment.query().count(), 0)
185
186 assert Notification.query().count() == 1
187 assert ChangesetComment.query().count() == 1
188
189 notification = Notification.query().all()[0]
190
191 comment_id = ChangesetComment.query().first().comment_id
192 assert notification.type_ == Notification.TYPE_CHANGESET_COMMENT
193
194 sbj = 'commented on commit `{0}` (status: Approved) ' \
195 'in the {1} repository'.format(
196 h.show_id(commit), backend.repo_name)
197 assert sbj in notification.subject
198
199 lnk = (u'/{0}/changeset/{1}#comment-{2}'.format(
200 backend.repo_name, commit_id, comment_id))
201 assert lnk in notification.body
202
163 def test_delete(self, backend):
203 def test_delete(self, backend):
164 self.log_user()
204 self.log_user()
165 commit_id = backend.repo.get_commit('300').raw_id
205 commit_id = backend.repo.get_commit('300').raw_id
General Comments 0
You need to be logged in to leave comments. Login now