allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [3/4] git commit: [#6249] ticket:453 Add test and docstring for Application.email_address
Date Tue, 29 Oct 2013 15:24:53 GMT
[#6249] ticket:453 Add test and docstring for Application.email_address


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

Branch: refs/heads/master
Commit: 513eecd75aecb14823b0a5247e4966e5463504ce
Parents: c6bb15b
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Thu Oct 17 11:10:46 2013 +0300
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Tue Oct 29 03:57:10 2013 +0000

----------------------------------------------------------------------
 Allura/allura/app.py                 | 11 +++++++++++
 Allura/allura/tests/unit/test_app.py |  4 ++++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/513eecd7/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index bca70e0..150816e 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -274,6 +274,17 @@ class Application(object):
 
     @property
     def email_address(self):
+        """Return email address for this Application.
+
+        Email address constructed from Application's url, and looks like this:
+
+            wiki@test.p.in.sf.net
+
+        where 'wiki@test.p' comes from app url (in this case /p/test/wiki/)
+        and '.in.sf.net' comes from 'forgemail.domain' config entry.
+
+        Assumes self.url returns a url path without domain, starting with '/'
+        """
         parts = list(reversed(self.url[1:-1].split('/')))
         return '%s@%s%s' % (parts[0], '.'.join(parts[1:]), config.common_suffix)
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/513eecd7/Allura/allura/tests/unit/test_app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/unit/test_app.py b/Allura/allura/tests/unit/test_app.py
index 83bfbc2..da36170 100644
--- a/Allura/allura/tests/unit/test_app.py
+++ b/Allura/allura/tests/unit/test_app.py
@@ -99,6 +99,10 @@ class TestAppDefaults(WithDatabase):
     def test_not_exportable_by_default(self):
         assert not self.app.exportable
 
+    def test_email_address(self):
+        self.app.url = '/p/project/mount-point/'
+        assert self.app.email_address == 'mount-point@project.p.in.sf.net'
+
 
 def install_app():
     project = create_project('myproject')


Mime
View raw message