Files
@ 6af3e67cc576
Branch filter:
Location: kallithea/rhodecode/tests/functional/test_changeset_comments.py
6af3e67cc576
6.0 KiB
text/x-python
Add Twitter's Bootstrap 3.0.0 CSS and Javascript files, under Apache License 2.0
These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:
I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip
with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip
And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.
and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
These files are exactly as they appear the upstream release 3.0.0 of
Bootstrap, which Twitter released under the Apache License 2.0. To extract
these files, I did the following:
I downloaded the following file:
https://github.com/twbs/bootstrap/archive/v3.0.0.zip
with sha256sum of:
$ sha256sum v3.0.0.zip
2d54f345f4abc6bf65ea648c323e9bae577e6febf755650e62555f2d7a222e17 v3.0.0.zip
And extracted from it these two files:
bootstrap-3.0.0/dist/css/bootstrap.css
bootstrap-3.0.0/dist/js/bootstrap.js
which are licensed under the Apache License 2.0.
and placed them into:
rhodecode/public/css/bootstrap.css
rhodecode/public/js/bootstrap.js
respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | from rhodecode.tests import *
from rhodecode.model.db import ChangesetComment, Notification, User, \
UserNotification
from rhodecode.model.meta import Session
class TestChangeSetCommentsController(TestController):
def setUp(self):
for x in ChangesetComment.query().all():
Session().delete(x)
Session().commit()
for x in Notification.query().all():
Session().delete(x)
Session().commit()
def tearDown(self):
for x in ChangesetComment.query().all():
Session().delete(x)
Session().commit()
for x in Notification.query().all():
Session().delete(x)
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)
response.mustcontain('''<div class="comments-number">%s comment '''
'''(0 inline)</div>''' % 1)
self.assertEqual(Notification.query().count(), 1)
self.assertEqual(ChangesetComment.query().count(), 1)
notification = Notification.query().all()[0]
ID = ChangesetComment.query().first().comment_id
self.assertEqual(notification.type_,
Notification.TYPE_CHANGESET_COMMENT)
sbj = (u'/vcs_test_hg/changeset/'
'27cd5cce30c96924232dffcd24178a07ffeb5dfc#comment-%s' % ID)
print "%s vs %s" % (sbj, notification.subject)
self.assertTrue(sbj in notification.subject)
def test_create_inline(self):
self.log_user()
rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
text = u'CommentOnRevision'
f_path = 'vcs/web/simplevcs/views/repository.py'
line = 'n1'
params = {'text': text, 'f_path': f_path, 'line': line}
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)
response.mustcontain(
'''<div class="comments-number">0 comments'''
''' (%s inline)</div>''' % 1
)
response.mustcontain(
'''<div style="display:none" class="inline-comment-placeholder" '''
'''path="vcs/web/simplevcs/views/repository.py" '''
'''target_id="vcswebsimplevcsviewsrepositorypy">'''
)
self.assertEqual(Notification.query().count(), 1)
self.assertEqual(ChangesetComment.query().count(), 1)
notification = Notification.query().all()[0]
ID = ChangesetComment.query().first().comment_id
self.assertEqual(notification.type_,
Notification.TYPE_CHANGESET_COMMENT)
sbj = (u'/vcs_test_hg/changeset/'
'27cd5cce30c96924232dffcd24178a07ffeb5dfc#comment-%s' % ID)
print "%s vs %s" % (sbj, notification.subject)
self.assertTrue(sbj in notification.subject)
def test_create_with_mention(self):
self.log_user()
rev = '27cd5cce30c96924232dffcd24178a07ffeb5dfc'
text = u'@test_regular check 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)
response.mustcontain('''<div class="comments-number">%s '''
'''comment (0 inline)</div>''' % 1)
self.assertEqual(Notification.query().count(), 2)
users = [x.user.username for x in UserNotification.query().all()]
# test_regular gets notification by @mention
self.assertEqual(sorted(users), [u'test_admin', u'test_regular'])
def test_delete(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)
comments = ChangesetComment.query().all()
self.assertEqual(len(comments), 1)
comment_id = comments[0].comment_id
self.app.delete(url(controller='changeset',
action='delete_comment',
repo_name=HG_REPO,
comment_id=comment_id))
comments = ChangesetComment.query().all()
self.assertEqual(len(comments), 0)
response = self.app.get(url(controller='changeset', action='index',
repo_name=HG_REPO, revision=rev))
response.mustcontain('''<div class="comments-number">0 comments'''
''' (0 inline)</div>''')
|