allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/3] allura git commit: [#7540] ticket:816 Fix tests
Date Mon, 13 Jul 2015 20:46:50 GMT
Repository: allura
Updated Branches:
  refs/heads/master f245736af -> b49a20bcf


[#7540] ticket:816 Fix tests


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/b49a20bc
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/b49a20bc
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/b49a20bc

Branch: refs/heads/master
Commit: b49a20bcfded19fd5b4859322ad250ae0c0837c8
Parents: fb7adce
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Jul 8 15:37:43 2015 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Mon Jul 13 20:01:44 2015 +0000

----------------------------------------------------------------------
 Allura/allura/tests/model/test_discussion.py | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/b49a20bc/Allura/allura/tests/model/test_discussion.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/model/test_discussion.py b/Allura/allura/tests/model/test_discussion.py
index 1768777..c94f2a6 100644
--- a/Allura/allura/tests/model/test_discussion.py
+++ b/Allura/allura/tests/model/test_discussion.py
@@ -29,7 +29,7 @@ from pylons import tmpl_context as c
 from nose.tools import assert_equals, with_setup
 import mock
 from mock import patch
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_in
 
 from ming.orm import session, ThreadLocalORMSession
 from webob import exc
@@ -208,7 +208,11 @@ def test_attachment_methods():
     ThreadLocalORMSession.flush_all()
     n = M.Notification.query.get(
         subject=u'[test:wiki] Test comment notification')
-    assert '\nAttachment: fake.txt (37 Bytes; text/plain)' in n.text
+    url = h.absurl('{}attachment/{}'.format(p.url(), fs.filename))
+    assert_in(
+        '\nAttachments:\n\n'
+        '- [fake.txt]({}) (37 Bytes; text/plain)'.format(url),
+        n.text)
 
 
 @with_setup(setUp, tearDown())
@@ -265,11 +269,16 @@ def test_notification_two_attaches():
     fs2.filename = 'fake2.txt'
     fs2.type = 'text/plain'
     fs2.file = StringIO('this is the content of the fake file\n')
-    t.post(text=u'test message', forum=None, subject='', file_info=[fs1, fs2])
+    p = t.post(text=u'test message', forum=None, subject='', file_info=[fs1, fs2])
     ThreadLocalORMSession.flush_all()
     n = M.Notification.query.get(
         subject=u'[test:wiki] Test comment notification')
-    assert '\nAttachment: fake.txt (37 Bytes; text/plain)  fake2.txt (37 Bytes; text/plain)'
in n.text
+    base_url = h.absurl('{}attachment/'.format(p.url()))
+    assert_in(
+        '\nAttachments:\n\n'
+        '- [fake.txt]({0}fake.txt) (37 Bytes; text/plain)\n'
+        '- [fake2.txt]({0}fake2.txt) (37 Bytes; text/plain)'.format(base_url),
+        n.text)
 
 
 @with_setup(setUp, tearDown)


Mime
View raw message