incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [18/18] git commit: [#6464] Fixed issues from rebase
Date Fri, 16 Aug 2013 02:07:43 GMT
[#6464] Fixed issues from rebase

Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>


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

Branch: refs/heads/cj/6464
Commit: 392b66ce5cb09f3f567e0d3cc34c491b227e7c1f
Parents: 592fced
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Aug 16 02:06:33 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Aug 16 02:06:33 2013 +0000

----------------------------------------------------------------------
 Allura/allura/lib/helpers.py                          |  3 +++
 Allura/allura/tests/test_helpers.py                   |  9 +++++----
 ForgeImporters/forgeimporters/google/__init__.py      |  2 +-
 .../tests/google/functional/test_tracker.py           | 14 ++++++++------
 4 files changed, 17 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/392b66ce/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index 01586c2..39bf250 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -956,6 +956,9 @@ def plain2markdown(text, preserve_multiple_spaces=False, has_html_entities=False
     if preserve_multiple_spaces:
         text = text.replace('\t', ' ' * 4)
         text = re_preserve_spaces.sub('&nbsp;', text)
+    else:
+        text = re_leading_spaces.sub('', text)
+    try:
         # try to use html2text for most of the escaping
         import html2text
         html2text.BODY_WIDTH = 0

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/392b66ce/Allura/allura/tests/test_helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 03a530c..4a0b80d 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -292,17 +292,18 @@ M & Ms - doesn't get escaped
 http://blah.com/?x=y&a=b - not escaped either
 '''
 
-    assert_equals(h.plain2markdown(text), expected)
+    dd.assert_equal(h.plain2markdown(text), expected)
 
-    assert_equals(h.plain2markdown('a foo  bar\n\n    code here?', preserve_multiple_spaces=True),
+    dd.assert_equal(h.plain2markdown('a foo  bar\n\n    code here?', preserve_multiple_spaces=True),
                 'a foo&nbsp; bar\n\n&nbsp;&nbsp;&nbsp; code here?')
 
-    assert_equals(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=True),
+    dd.assert_equal(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=True),
                  '&nbsp;&nbsp;&nbsp; tab before \(stuff\)')
 
-    assert_equals(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=False),
+    dd.assert_equal(h.plain2markdown('\ttab before (stuff)', preserve_multiple_spaces=False),
                  'tab before \(stuff\)')
 
+
 @td.without_module('html2text')
 def test_plain2markdown():
     """Test plain2markdown using fallback regexp to escape markdown.

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/392b66ce/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index f60bc58..9b3130b 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -285,6 +285,6 @@ class Attachment(object):
 
     @property
     def file(self):
-        fp_ish = urllib2.urlopen(self.url)
+        fp_ish = GoogleCodeProjectExtractor(None).urlopen(self.url)
         fp = StringIO(fp_ish.read())
         return fp

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/392b66ce/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
index 7d67255..62c4453 100644
--- a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
@@ -29,15 +29,17 @@ from IPython.testing.decorators import module_not_available, skipif
 from alluratest.controller import setup_basic_test
 from allura.tests.decorators import without_module
 from allura import model as M
+from allura.lib import helpers as h
 from forgetracker import model as TM
-from .... import google
-from ....google import tracker
+from forgeimporters import base
+from forgeimporters import google
+from forgeimporters.google import tracker
 
 
 class TestGCTrackerImporter(TestCase):
     def _make_extractor(self, html):
-        with mock.patch.object(google, 'urllib2') as urllib2:
-            urllib2.urlopen.return_value = ''
+        with mock.patch.object(base.h, 'urlopen') as urlopen:
+            urlopen.return_value = ''
             extractor = google.GoogleCodeProjectExtractor('my-project', 'project_info')
         extractor.page = BeautifulSoup(html)
         extractor.url = "http://test/issue/?id=1"
@@ -45,9 +47,9 @@ class TestGCTrackerImporter(TestCase):
 
     def _make_ticket(self, issue):
         self.assertIsNone(self.project.app_instance('test-issue'))
-        with mock.patch.object(google, 'urllib2') as urllib2,\
+        with mock.patch.object(base.h, 'urlopen') as urlopen,\
              mock.patch.object(google.tracker, 'GoogleCodeProjectExtractor') as GPE:
-            urllib2.urlopen = lambda url: mock.Mock(read=lambda: url)
+            urlopen.side_effect = lambda req, **kw: mock.Mock(read=req.get_full_url)
             GPE.iter_issues.return_value = [issue]
             gti = google.tracker.GoogleCodeTrackerImporter()
             gti.import_tool(self.project, self.user, 'test-issue-project', mount_point='test-issue')


Mime
View raw message