allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hei...@apache.org
Subject allura git commit: [#7825] Updated tests for commit notification emails.
Date Thu, 04 Jun 2015 04:58:20 GMT
Repository: allura
Updated Branches:
  refs/heads/hs/7825 fa546c15f -> 9ae0ba5eb (forced update)


[#7825] Updated tests for commit notification emails.


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

Branch: refs/heads/hs/7825
Commit: 9ae0ba5eb5267c3c7de448174f3abf5214c10629
Parents: 55a78ce
Author: Heith Seewald <hseewald@slashdotmedia.com>
Authored: Tue May 26 20:38:27 2015 -0400
Committer: Heith Seewald <hseewald@slashdotmedia.com>
Committed: Thu Jun 4 00:57:24 2015 -0400

----------------------------------------------------------------------
 Allura/allura/model/repo_refresh.py                    |  9 ++++-----
 Allura/allura/model/repository.py                      |  2 +-
 Allura/allura/templates/mail/commits.md                |  5 +++--
 ForgeGit/forgegit/tests/functional/test_controllers.py |  4 +---
 ForgeGit/forgegit/tests/model/test_repository.py       | 10 +++++-----
 ForgeSVN/forgesvn/tests/model/test_repository.py       | 12 +++++++-----
 6 files changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/9ae0ba5e/Allura/allura/model/repo_refresh.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repo_refresh.py b/Allura/allura/model/repo_refresh.py
index ae73a44..3a575e1 100644
--- a/Allura/allura/model/repo_refresh.py
+++ b/Allura/allura/model/repo_refresh.py
@@ -390,22 +390,21 @@ def send_notifications(repo, commit_ids):
                 link=href,
                 unique_id=href)
 
+            summary = g.markdown_commit.convert(ci.message) if ci.message else ""
             commit_msgs.append(dict(
                 author=ci.authored.name,
-                date=ci.authored.date,
-                summary=ci.summary,
+                date=ci.authored.date.strftime("%m/%d/%Y %H:%M"),
+                summary=summary,
                 branches=repo.symbolics_for_commit(ci)[0],
                 commit_url=base_url + href))
 
     if commit_msgs:
         if len(commit_msgs) > 1:
             subject = u"{} new commits to {}".format(len(commit_msgs), repo.app.config.options.mount_label)
-            msg_separator = u"\n\n-----"
         else:
             subject = u'New commit by {}'.format(commit_msgs[0]['author'])
-            msg_separator = u""
         template = g.jinja2_env.get_template("allura:templates/mail/commits.md")
-        text = msg_separator.join([template.render(d) for d in commit_msgs])
+        text = u"\n\n-----".join([template.render(d) for d in commit_msgs])
 
         Notification.post(
             artifact=repo,

http://git-wip-us.apache.org/repos/asf/allura/blob/9ae0ba5e/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index ec623a3..022343f 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -578,7 +578,7 @@ class Repository(Artifact, ActivityObject):
         result.update(
             name_s=self.name,
             type_s=self.type_s,
-            title='Repository %s %s' % (self.project.name, self.name))
+            title=u'{} {} repository'.format(self.project.name, self.app.tool_label))
         return result
 
     @property

http://git-wip-us.apache.org/repos/asf/allura/blob/9ae0ba5e/Allura/allura/templates/mail/commits.md
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/mail/commits.md b/Allura/allura/templates/mail/commits.md
index c0a5f76..7d4e4b1 100644
--- a/Allura/allura/templates/mail/commits.md
+++ b/Allura/allura/templates/mail/commits.md
@@ -16,8 +16,9 @@
        specific language governing permissions and limitations
        under the License.
 --> #}
+{% if branches %}## Branch: {% for b in branches %} {{ b }}  {% endfor%}{% endif %}
 
-{% if branches %}# Branch: {% for b in branches %} {{ b }} {% endfor%}{% endif %}
 {{summary}}
-By {{ author }} on {{ date }}.
+
+By {{ author }} on {{ date }}
 [**View Changes**]({{ commit_url }})

http://git-wip-us.apache.org/repos/asf/allura/blob/9ae0ba5e/ForgeGit/forgegit/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/functional/test_controllers.py b/ForgeGit/forgegit/tests/functional/test_controllers.py
index 9de228a..69d60b2 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -264,9 +264,7 @@ class TestRootController(_TestCase):
         assert '<table class="side-by-side-diff">' in r
 
     def test_refresh(self):
-        notification = M.Notification.query.find(
-            dict(subject='[test:src-git] 5 new commits to Test Project Git')
-        ).first()
+        notification = M.Notification.query.find({'subject': '[test:src-git] 5 new commits
to Git'}).first()
         assert notification
         domain = '.'.join(
             reversed(c.app.url[1:-1].split('/'))).replace('_', '-')

http://git-wip-us.apache.org/repos/asf/allura/blob/9ae0ba5e/ForgeGit/forgegit/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/tests/model/test_repository.py b/ForgeGit/forgegit/tests/model/test_repository.py
index e516f35..dd67987 100644
--- a/ForgeGit/forgegit/tests/model/test_repository.py
+++ b/ForgeGit/forgegit/tests/model/test_repository.py
@@ -29,7 +29,7 @@ from pylons import tmpl_context as c, app_globals as g
 import tg
 from ming.base import Object
 from ming.orm import ThreadLocalORMSession, session
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_in
 from testfixtures import TempDirectory
 from datadiff.tools import assert_equals
 
@@ -368,15 +368,15 @@ class TestGitRepo(unittest.TestCase, RepoImplTestBase):
         send_notifications(
             self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', ])
         ThreadLocalORMSession.flush_all()
-        n = M.Notification.query.find(
-            dict(subject='[test:src-git] [1e146e] - Rick Copeland: Change README')).first()
+
+        n = M.Notification.query.find({'subject': u'[test:src-git] New commit by Rick Copeland'}).first()
         assert n
-        assert 'master: ' in n.text, n.text
+        assert_in('Change README', n.text)
         send_notifications(
             self.repo, ['1e146e67985dcd71c74de79613719bef7bddca4a', 'df30427c488aeab84b2352bdf88a3b19223f9d7a'])
         ThreadLocalORMSession.flush_all()
         assert M.Notification.query.find(
-            dict(subject='[test:src-git] 2 new commits to Test Project Git')).first()
+            dict(subject=u'[test:src-git] 2 new commits to Git')).first()
 
     def test_tarball(self):
         tmpdir = tg.config['scm.repos.tarball.root']

http://git-wip-us.apache.org/repos/asf/allura/blob/9ae0ba5e/ForgeSVN/forgesvn/tests/model/test_repository.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/model/test_repository.py b/ForgeSVN/forgesvn/tests/model/test_repository.py
index 744d30a..79beb52 100644
--- a/ForgeSVN/forgesvn/tests/model/test_repository.py
+++ b/ForgeSVN/forgesvn/tests/model/test_repository.py
@@ -27,7 +27,7 @@ from zipfile import ZipFile
 from collections import defaultdict
 from pylons import tmpl_context as c, app_globals as g
 import mock
-from nose.tools import assert_equal
+from nose.tools import assert_equal, assert_in
 from datadiff.tools import assert_equals
 import tg
 import ming
@@ -693,10 +693,10 @@ class TestSVNRev(unittest.TestCase):
         ThreadLocalORMSession.flush_all()
         send_notifications(self.repo, [self.repo.rev_to_commit_id(1)])
         ThreadLocalORMSession.flush_all()
-        n = M.Notification.query.find(
-            dict(subject='[test:src] [r1] - rick446: Create readme')).first()
+        n = M.Notification.query.find({u'subject': u'[test:src] New commit by rick446'}).first()
         assert n
-        assert_equal(n.text, 'Create readme http://localhost:8080/p/test/src/1/')
+        assert_in(u'By rick446', n.text)
+        assert_in(u'Create readme', n.text)
 
 
 class _Test(unittest.TestCase):
@@ -869,6 +869,7 @@ class TestRepo(_TestWithRepo):
             M.repository.CommitDoc(dict(
                 authored=dict(
                     name=committer_name,
+                    date=datetime(2010, 10, 8, 15, 32, 48, 0),
                     email=committer_email),
                 _id=oid)).m.insert()
         self.repo._impl.refresh_commit_info = refresh_commit_info
@@ -880,7 +881,8 @@ class TestRepo(_TestWithRepo):
         notifications = M.Notification.query.find().all()
         for n in notifications:
             if '100 new commits' in n.subject:
-                assert "master,branch:  by %s http://localhost:8080/ci/foo99" % committer_name
in n.text
+                assert_in(u'By Test Committer on 10/08/2010 15:32', n.text)
+                assert_in(u'http://localhost:8080/ci/foo99/', n.text)
                 break
         else:
             assert False, 'Did not find notification'


Mime
View raw message