You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/09/03 23:02:59 UTC

[1/3] git commit: [#6619] update all the tests using :80

Updated Branches:
  refs/heads/master 7a51d42e7 -> 8b15df901


[#6619] update all the tests using :80


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

Branch: refs/heads/master
Commit: 8b15df9016a6a63154b2bcc338a81c337dbea0d8
Parents: f1253f6
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Aug 29 19:31:14 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Sep 3 21:01:57 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_rest.py               |  2 +-
 Allura/allura/tests/test_globals.py                       |  4 ++--
 ForgeBlog/forgeblog/tests/functional/test_rest.py         |  2 +-
 .../forgediscussion/tests/functional/test_forum_admin.py  |  4 ++--
 .../forgediscussion/tests/functional/test_rest.py         | 10 +++++-----
 ForgeGit/forgegit/tests/functional/test_controllers.py    |  8 ++++----
 ForgeSVN/forgesvn/tests/functional/test_controllers.py    |  8 ++++----
 ForgeTracker/forgetracker/tests/functional/test_root.py   | 10 +++++-----
 ForgeWiki/forgewiki/tests/functional/test_rest.py         |  4 ++--
 9 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index 0977f26..8bb3a28 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -80,7 +80,7 @@ class TestRestHome(TestRestApiBase):
         admin_dev = r.json['developers'][0]
         assert_equal(admin_dev['username'], 'test-admin')
         assert_equal(admin_dev['name'], 'Test Admin')
-        assert_equal(admin_dev['url'], 'http://localhost:80/u/test-admin/')
+        assert_equal(admin_dev['url'], 'http://localhost/u/test-admin/')
 
     @td.with_tool('test', 'Tickets', 'bugs')
     @td.with_tool('test', 'Tickets', 'private-bugs')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/Allura/allura/tests/test_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_globals.py b/Allura/allura/tests/test_globals.py
index 437021b..3ce26bb 100644
--- a/Allura/allura/tests/test_globals.py
+++ b/Allura/allura/tests/test_globals.py
@@ -54,8 +54,8 @@ def test_app_globals():
     g.oid_session()
     with h.push_context('test', 'wiki', neighborhood='Projects'):
         assert g.app_static('css/wiki.css') == '/nf/_static_/wiki/css/wiki.css', g.app_static('css/wiki.css')
-        assert g.url('/foo', a='foo bar') == 'http://localhost:80/foo?a=foo+bar', g.url('/foo', a='foo bar')
-        assert g.url('/foo') == 'http://localhost:80/foo', g.url('/foo')
+        assert g.url('/foo', a='foo bar') == 'http://localhost/foo?a=foo+bar', g.url('/foo', a='foo bar')
+        assert g.url('/foo') == 'http://localhost/foo', g.url('/foo')
 
 
 @with_setup(teardown=setUp) # reset everything we changed

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeBlog/forgeblog/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/functional/test_rest.py b/ForgeBlog/forgeblog/tests/functional/test_rest.py
index f545c7e..b1b3bc7 100644
--- a/ForgeBlog/forgeblog/tests/functional/test_rest.py
+++ b/ForgeBlog/forgeblog/tests/functional/test_rest.py
@@ -44,7 +44,7 @@ class TestBlogApi(TestRestApiBase):
             'labels': 'label1, label2'
         }
         r = self.api_post('/rest/p/test/blog/', **data)
-        assert_equal(r.location, 'http://localhost:80/rest/p/test/blog/%s/%s/test/' % (date.today().strftime("%Y"), date.today().strftime("%m")))
+        assert_equal(r.location, 'http://localhost/rest/p/test/blog/%s/%s/test/' % (date.today().strftime("%Y"), date.today().strftime("%m")))
         assert_equal(r.status_int, 201)
         url = '/rest' + BM.BlogPost.query.find().first().url()
         r = self.api_get('/rest/p/test/blog/')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py b/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
index cb85182..8a92969 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_forum_admin.py
@@ -288,5 +288,5 @@ class TestForumAdmin(TestController):
         r = self.app.post('/discussion/save_new_topic', params=params)
         M.MonQTask.run_ready()
         email_tasks = M.MonQTask.query.find(dict(task_name='allura.tasks.mail_tasks.sendsimplemail')).all()
-        assert 'Sent from sourceforge.net because email@monitoring.com is subscribed to http://localhost:80/p/test/discussion/testforum/' in email_tasks[0].kwargs['text'],email_tasks[0].kwargs['text']
-        assert 'a project admin can change settings at http://localhost:80/p/test/admin/discussion/forums' in email_tasks[0].kwargs['text']
+        assert 'Sent from sourceforge.net because email@monitoring.com is subscribed to http://localhost/p/test/discussion/testforum/' in email_tasks[0].kwargs['text'],email_tasks[0].kwargs['text']
+        assert 'a project admin can change settings at http://localhost/p/test/admin/discussion/forums' in email_tasks[0].kwargs['text']

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
index afdcdc5..d9f0c39 100644
--- a/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
+++ b/ForgeDiscussion/forgediscussion/tests/functional/test_rest.py
@@ -71,14 +71,14 @@ class TestRootRestController(TestDiscussionApiBase):
         assert_equal(forums[0]['name'], 'General Discussion')
         assert_equal(forums[0]['description'], 'Forum about anything you want to talk about.')
         assert_equal(forums[0]['num_topics'], 2)
-        assert_equal(forums[0]['url'], 'http://localhost:80/rest/p/test/discussion/general/')
+        assert_equal(forums[0]['url'], 'http://localhost/rest/p/test/discussion/general/')
         assert_equal(forums[0]['last_post']['subject'], 'Hi guys')
         assert_equal(forums[0]['last_post']['author'], 'test-admin')
         assert_equal(forums[0]['last_post']['text'], 'Hi boys and girls')
         assert_equal(forums[1]['name'], u'Say Héllo')
         assert_equal(forums[1]['description'], u'Say héllo here')
         assert_equal(forums[1]['num_topics'], 0)
-        assert_equal(forums[1]['url'], 'http://localhost:80/rest/p/test/discussion/h%C3%A9llo/')
+        assert_equal(forums[1]['url'], 'http://localhost/rest/p/test/discussion/h%C3%A9llo/')
         assert_equal(forums[1]['last_post'], None)
 
     def test_forum(self):
@@ -94,7 +94,7 @@ class TestRootRestController(TestDiscussionApiBase):
         assert_equal(topics[0]['last_post']['author'], 'test-admin')
         assert_equal(topics[0]['last_post']['text'], 'Hi boys and girls')
         t = ForumThread.query.find({'subject': 'Hi guys'}).first()
-        url = 'http://localhost:80/rest/p/test/discussion/general/thread/%s/' % t._id
+        url = 'http://localhost/rest/p/test/discussion/general/thread/%s/' % t._id
         assert_equal(topics[0]['url'], url)
         assert_equal(topics[1]['subject'], 'Let\'s talk')
         assert_equal(topics[1]['num_views'], 0)
@@ -102,7 +102,7 @@ class TestRootRestController(TestDiscussionApiBase):
         assert_equal(topics[1]['last_post']['author'], 'test-admin')
         assert_equal(topics[1]['last_post']['text'], '1st post')
         t = ForumThread.query.find({'subject': 'Let\'s talk'}).first()
-        url = 'http://localhost:80/rest/p/test/discussion/general/thread/%s/' % t._id
+        url = 'http://localhost/rest/p/test/discussion/general/thread/%s/' % t._id
         assert_equal(topics[1]['url'], url)
 
     def test_forum_show_ok_topics(self):
@@ -128,7 +128,7 @@ class TestRootRestController(TestDiscussionApiBase):
         assert_equal(forum['name'], 'General Discussion')
         assert_equal(forum['description'], 'Forum about anything you want to talk about.')
         topics = forum['topics']
-        topic = self.api_get(topics[0]['url'][len('http://localhost:80'):])
+        topic = self.api_get(topics[0]['url'][len('http://localhost'):])
         topic = topic.json['topic']
         assert_equal(len(topic['posts']), 1)
         assert_equal(topic['subject'], 'Hi guys')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/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 638fd90..919e97b 100644
--- a/ForgeGit/forgegit/tests/functional/test_controllers.py
+++ b/ForgeGit/forgegit/tests/functional/test_controllers.py
@@ -176,10 +176,10 @@ class TestRootController(_TestCase):
             description = channel.find('description').text
             assert_equal(description, 'Recent changes to Git repository in test project')
             link = channel.find('link').text
-            assert_equal(link, 'http://localhost:80/p/test/src-git/')
+            assert_equal(link, 'http://localhost/p/test/src-git/')
             commit = channel.find('item')
             assert_equal(commit.find('title').text, 'Initial commit')
-            link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
+            link = 'http://localhost/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
             assert_equal(commit.find('link').text, link)
             assert_equal(commit.find('guid').text, link)
         # .atom has slightly different structure
@@ -188,10 +188,10 @@ class TestRootController(_TestCase):
         title = r.xml.find(prefix + 'title').text
         assert_equal(title, 'test Git changes')
         link = r.xml.find(prefix + 'link').attrib['href']
-        assert_equal(link, 'http://localhost:80/p/test/src-git/')
+        assert_equal(link, 'http://localhost/p/test/src-git/')
         commit = r.xml.find(prefix + 'entry')
         assert_equal(commit.find(prefix + 'title').text, 'Initial commit')
-        link = 'http://localhost:80/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
+        link = 'http://localhost/p/test/src-git/ci/9a7df788cf800241e3bb5a849c8870f2f8259d98/'
         assert_equal(commit.find(prefix + 'link').attrib['href'], link)
 
     def test_tree(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeSVN/forgesvn/tests/functional/test_controllers.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/tests/functional/test_controllers.py b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
index eb7d409..ae8c86d 100644
--- a/ForgeSVN/forgesvn/tests/functional/test_controllers.py
+++ b/ForgeSVN/forgesvn/tests/functional/test_controllers.py
@@ -109,10 +109,10 @@ class TestRootController(SVNTestController):
             description = channel.find('description').text
             assert_equal(description, 'Recent changes to SVN repository in test project')
             link = channel.find('link').text
-            assert_equal(link, 'http://localhost:80/p/test/src/')
+            assert_equal(link, 'http://localhost/p/test/src/')
             commit = channel.find('item')
             assert_equal(commit.find('title').text, 'Create readme')
-            link = 'http://localhost:80/p/test/src/1/'
+            link = 'http://localhost/p/test/src/1/'
             assert_equal(commit.find('link').text, link)
             assert_equal(commit.find('guid').text, link)
         # .atom has slightly different structure
@@ -121,10 +121,10 @@ class TestRootController(SVNTestController):
         title = r.xml.find(prefix + 'title').text
         assert_equal(title, 'test SVN changes')
         link = r.xml.find(prefix + 'link').attrib['href']
-        assert_equal(link, 'http://localhost:80/p/test/src/')
+        assert_equal(link, 'http://localhost/p/test/src/')
         commit = r.xml.find(prefix + 'entry')
         assert_equal(commit.find(prefix + 'title').text, 'Create readme')
-        link = 'http://localhost:80/p/test/src/1/'
+        link = 'http://localhost/p/test/src/1/'
         assert_equal(commit.find(prefix + 'link').attrib['href'], link)
 
     def test_commit(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index a78abd9..0ba4f0b 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -1877,10 +1877,10 @@ class TestFunctionalController(TrackerTestController):
         discussion_url = r.html.findAll('form')[-1]['action'][:-4]
         r = self.app.get('/rest/p/test/bugs/1/')
         r = json.loads(r.body)
-        assert_equal(r['ticket']['discussion_thread_url'],'http://localhost:80/rest%s' % discussion_url)
+        assert_equal(r['ticket']['discussion_thread_url'],'http://localhost/rest%s' % discussion_url)
         slug = r['ticket']['discussion_thread']['posts'][0]['slug']
         assert_equal(r['ticket']['discussion_thread']['posts'][0]['attachments'][0]['url'],
-                     'http://localhost:80%s%s/attachment/test.txt' % (discussion_url, slug))
+                     'http://localhost%s%s/attachment/test.txt' % (discussion_url, slug))
         assert_equal(r['ticket']['discussion_thread']['posts'][0]['attachments'][0]['bytes'], 11)
 
         file_name = 'test_root.py'
@@ -1891,7 +1891,7 @@ class TestFunctionalController(TrackerTestController):
         }, upload_files=[upload]).follow()
         r = self.app.get('/rest/p/test/bugs/1/')
         r = json.loads(r.body)
-        assert_equal(r['ticket']['attachments'][0]['url'], 'http://localhost:80/p/test/bugs/1/attachment/test_root.py')
+        assert_equal(r['ticket']['attachments'][0]['url'], 'http://localhost/p/test/bugs/1/attachment/test_root.py')
 
     def test_html_escaping(self):
         with mock.patch.object(mail_tasks.smtp_client, '_client') as _client:
@@ -2138,8 +2138,8 @@ class TestEmailMonitoring(TrackerTestController):
         ThreadLocalORMSession.flush_all()
         M.MonQTask.run_ready()
         email_tasks = M.MonQTask.query.find(dict(task_name='allura.tasks.mail_tasks.sendsimplemail')).all()
-        assert 'Sent from sourceforge.net because mailinglist@example.com is subscribed to http://localhost:80/p/test/bugs/' in email_tasks[0].kwargs['text']
-        assert 'a project admin can change settings at http://localhost:80/p/test/admin/bugs/options' in email_tasks[0].kwargs['text']
+        assert 'Sent from sourceforge.net because mailinglist@example.com is subscribed to http://localhost/p/test/bugs/' in email_tasks[0].kwargs['text']
+        assert 'a project admin can change settings at http://localhost/p/test/admin/bugs/options' in email_tasks[0].kwargs['text']
 
 class TestCustomUserField(TrackerTestController):
     def setUp(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8b15df90/ForgeWiki/forgewiki/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_rest.py b/ForgeWiki/forgewiki/tests/functional/test_rest.py
index 0b93680..2b5cfd5 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_rest.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_rest.py
@@ -45,8 +45,8 @@ class TestWikiApi(TestRestApiBase):
         self.app.post('/wiki/Home/attach', upload_files=[('file_info', 'test_root.py', content)])
         r = self.app.get('/rest/p/test/wiki/Home/')
         r = json.loads(r.body)
-        assert_equal(r['attachments'][0]['url'], 'http://localhost:80/p/test/wiki/Home/attachment/test_root.py')
-        assert_equal(r['discussion_thread_url'], 'http://localhost:80/rest%s' % discussion_url)
+        assert_equal(r['attachments'][0]['url'], 'http://localhost/p/test/wiki/Home/attachment/test_root.py')
+        assert_equal(r['discussion_thread_url'], 'http://localhost/rest%s' % discussion_url)
         assert_equal(r['discussion_thread']['_id'], discussion_url.split('/')[-2])
         self.app.post('/wiki/Home/attach', upload_files=[('file_info', '__init__.py', content),])
         r = self.app.get('/rest/p/test/wiki/Home/')


[2/3] git commit: [#6619] make h.absurl() have proper value in tasks

Posted by tv...@apache.org.
[#6619] make h.absurl() have proper value in tasks

* add hostname to taskd fake request
* add hostname for tests
* request.host_url is better, it doesn't include port numbers
* add tests


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

Branch: refs/heads/master
Commit: f1253f6a03cd48d2d6c088fd4c0de681cb9311ad
Parents: 208f608
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Aug 29 19:16:19 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Sep 3 21:01:57 2013 +0000

----------------------------------------------------------------------
 Allura/allura/command/taskd.py      | 10 ++++++----
 Allura/allura/lib/app_globals.py    |  4 ++--
 Allura/allura/lib/helpers.py        | 20 +++++++++++++-------
 Allura/allura/tests/test_helpers.py | 12 ++++++++++++
 4 files changed, 33 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/command/taskd.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index 50402f0..87dbfa4 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -27,7 +27,7 @@ import sys
 import faulthandler
 import pylons
 from setproctitle import setproctitle, getproctitle
-
+import tg
 from paste.deploy import loadapp
 from paste.deploy.converters import asint
 from webob import Request
@@ -134,10 +134,12 @@ class TaskdCommand(base.Command):
                             only=only)
                     if self.task:
                         with(proctitle("taskd:{0}:{1}".format(
-                            self.task.task_name, self.task._id))):
+                                self.task.task_name, self.task._id))):
                             # Build the (fake) request
-                            r = Request.blank('/--%s--/%s/' % (self.task.task_name, self.task._id),
-                                              {'task': self.task,
+                            request_path = '/--%s--/%s/' % (self.task.task_name, self.task._id)
+                            r = Request.blank(request_path,
+                                              base_url=tg.config['base_url'].rstrip('/') + request_path,
+                                              environ={'task': self.task,
                                                })
                             list(wsgi_app(r.environ, start_response))
                             self.task = None

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 276af63..c1c0b32 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -471,9 +471,9 @@ class Globals(object):
     def url(self, base, **kw):
         params = urlencode(kw)
         if params:
-            return '%s://%s%s?%s' % (request.scheme, request.host, base, params)
+            return '%s%s?%s' % (request.host_url, base, params)
         else:
-            return '%s://%s%s' % (request.scheme, request.host, base)
+            return '%s%s' % (request.host_url, base)
 
     def postload_contents(self):
         text = '''

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 3715de6..adfb339 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -360,18 +360,24 @@ class DateTimeConverter(FancyValidator):
     def _from_python(self, value, state):
         return value.isoformat()
 
+
 def absurl(url):
-    if url is None: return None
-    if '://' in url: return url
-    # some __json__ methods call absurl
-    # and in tests request is not set so exception raises
-    # this check prevents it
+    """
+    Given a root-relative URL, return a full URL including protocol and host
+    """
+    if url is None:
+        return None
+    if '://' in url:
+        return url
     try:
-        host = request.scheme + '://' + request.host
+        # try request first, so we can get proper http/https value
+        host = request.host_url
     except TypeError:
-        host = ''
+        # for tests, etc
+        host = tg.config['base_url'].rstrip('/')
     return host + url
 
+
 def diff_text(t1, t2, differ=None):
     t1_lines = t1.replace('\r', '').split('\n')
     t2_lines = t2.replace('\r', '').split('\n')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f1253f6a/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 3c79e61..3d4ad96 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -25,6 +25,7 @@ from pylons import tmpl_context as c
 from nose.tools import eq_, assert_equals
 from IPython.testing.decorators import skipif, module_not_available
 from datadiff import tools as dd
+from webob import Request
 
 from allura import model as M
 from allura.lib import helpers as h
@@ -382,3 +383,14 @@ class TestUrlOpen(TestCase):
         urlopen.side_effect = side_effect
         self.assertRaises(HTTPError, h.urlopen, 'myurl')
         self.assertEqual(urlopen.call_count, 1)
+
+
+def test_absurl_no_request():
+    assert_equals(h.absurl('/p/test/foobar'), 'http://localhost/p/test/foobar')
+
+
+@patch.object(h, 'request',
+              new=Request.blank('/p/test/foobar', base_url='https://www.mysite.com/p/test/foobar'))
+def test_absurl_with_request():
+    assert_equals(h.absurl('/p/test/foobar'), 'https://www.mysite.com/p/test/foobar')
+


[3/3] git commit: [#6619] backwards compatibility for old tickets

Posted by tv...@apache.org.
[#6619] backwards compatibility for old tickets


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

Branch: refs/heads/master
Commit: 208f608f3bd9dd22b700fb9175e5e2a259009da4
Parents: 7a51d42
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Aug 29 17:25:43 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Sep 3 21:01:57 2013 +0000

----------------------------------------------------------------------
 ForgeTracker/forgetracker/tracker_main.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/208f608f/ForgeTracker/forgetracker/tracker_main.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tracker_main.py b/ForgeTracker/forgetracker/tracker_main.py
index c8e728c..8aa29f6 100644
--- a/ForgeTracker/forgetracker/tracker_main.py
+++ b/ForgeTracker/forgetracker/tracker_main.py
@@ -412,7 +412,8 @@ class ForgeTrackerApp(Application):
         f.write('{"tickets": [')
         tickets = TM.Ticket.query.find(dict(
             app_config_id=self.config._id,
-            deleted=False))
+            deleted={'$ne': True},  # backwards compat for old tickets that don't have it set
+        ))
         for i, ticket in enumerate(tickets):
             if i > 0:
                 f.write(',')