incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [22/22] git commit: [#6464] Fixed HTML entities in ticket summary for GC tracker importer
Date Tue, 20 Aug 2013 17:45:52 GMT
[#6464] Fixed HTML entities in ticket summary for GC tracker importer

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/1e939642
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1e939642
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1e939642

Branch: refs/heads/cj/6464
Commit: 1e939642389d4c3e7494f4a0c18984f4f613e3a1
Parents: a5c05c1
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Tue Aug 20 17:45:16 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Tue Aug 20 17:45:16 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py       |  4 +++-
 .../forgeimporters/tests/data/google/test-issue.html   |  2 +-
 .../tests/google/functional/test_tracker.py            |  2 +-
 .../forgeimporters/tests/google/test_extractor.py      | 13 ++++++++++---
 4 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1e939642/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index bf9d5f0..18a6209 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -181,7 +181,9 @@ class GoogleCodeProjectExtractor(ProjectExtractor):
             start += limit
 
     def get_issue_summary(self):
-        return self.page.find(id='issueheader').findAll('td', limit=2)[1].span.string.strip()
+        text = self.page.find(id='issueheader').findAll('td', limit=2)[1].span.string.strip()
+        bs = BeautifulSoup(text, convertEntities=BeautifulSoup.HTML_ENTITIES)
+        return bs.string
 
     def get_issue_description(self):
         return _as_text(self.page.find(id='hc0').pre).strip()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1e939642/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/data/google/test-issue.html b/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
index 6373356..63670fd 100644
--- a/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
+++ b/ForgeImporters/forgeimporters/tests/data/google/test-issue.html
@@ -175,7 +175,7 @@ contributes to open source, such as <a href="http://www.firefox.com">Firefox</a>
  Issue <a href="detail?id=6">6</a>:
  </td>
 <td width="90%" class="vt">
-<span class="h3">Test Issue</span>
+<span class="h3">Test &quot;Issue&quot;</span>
 </td>
 <td>
 <div class="pagination">

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1e939642/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 5d991d7..bf15cc2 100644
--- a/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
+++ b/ForgeImporters/forgeimporters/tests/google/functional/test_tracker.py
@@ -82,7 +82,7 @@ class TestGCTrackerImporter(TestCase):
         ticket = self._make_ticket(self.test_issue)
         self.assertEqual(ticket.reported_by, anon)
         self.assertIsNone(ticket.assigned_to_id)
-        self.assertEqual(ticket.summary, 'Test Issue')
+        self.assertEqual(ticket.summary, 'Test "Issue"')
         assert_equal(ticket.description,
                 '*Originally created by:* [john...@gmail.com](http://code.google.com/u/101557263855536553789/)\n'
                 '*Originally owned by:* [john...@gmail.com](http://code.google.com/u/101557263855536553789/)\n'

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1e939642/ForgeImporters/forgeimporters/tests/google/test_extractor.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/tests/google/test_extractor.py b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
index f212575..92c5fb2 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
@@ -35,8 +35,14 @@ class TestGoogleCodeProjectExtractor(TestCase):
         self.project.get_tool_data.return_value = 'my-project'
 
     def tearDown(self):
-        self._p_urlopen.stop()
-        self._p_soup.stop()
+        for patcher in ('_p_urlopen', '_p_soup'):
+            try:
+                getattr(self, patcher).stop()
+            except RuntimeError as e:
+                if 'unstarted patcher' in str(e):
+                    pass  # test case might stop them early
+                else:
+                    raise
 
     def test_init(self):
         extractor = google.GoogleCodeProjectExtractor('my-project', 'project_info')
@@ -157,7 +163,8 @@ class TestGoogleCodeProjectExtractor(TestCase):
         self.assertEqual(gpe.get_issue_owner().name, 'john...@gmail.com')
         self.assertEqual(gpe.get_issue_owner().url, 'http://code.google.com/u/101557263855536553789/')
         self.assertEqual(gpe.get_issue_status(), 'Started')
-        self.assertEqual(gpe.get_issue_summary(), 'Test Issue')
+        self._p_soup.stop()
+        self.assertEqual(gpe.get_issue_summary(), 'Test "Issue"')
         assert_equal(gpe.get_issue_description(),
                 'Test *Issue* for testing\n'
                 '\n'


Mime
View raw message