incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject git commit: [#6769] Fixed issue with calling get_issue_ids in GC Tracker importer
Date Fri, 18 Oct 2013 16:07:54 GMT
Updated Branches:
  refs/heads/cj/6769 e1967ec47 -> b4945f09f


[#6769] Fixed issue with calling get_issue_ids in 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/b4945f09
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/b4945f09
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/b4945f09

Branch: refs/heads/cj/6769
Commit: b4945f09fc257e2d28d04ce49dfd70287fd3434c
Parents: e1967ec
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Fri Oct 18 16:07:40 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Fri Oct 18 16:07:40 2013 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/__init__.py             | 7 ++++---
 ForgeImporters/forgeimporters/tests/google/test_extractor.py | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b4945f09/ForgeImporters/forgeimporters/google/__init__.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/__init__.py b/ForgeImporters/forgeimporters/google/__init__.py
index 8dcd876..f7c00e5 100644
--- a/ForgeImporters/forgeimporters/google/__init__.py
+++ b/ForgeImporters/forgeimporters/google/__init__.py
@@ -148,7 +148,8 @@ class GoogleCodeProjectExtractor(ProjectExtractor):
         Iterate over all issues for a project,
         using paging to keep the responses reasonable.
         """
-        issue_ids = cls.get_issue_ids(project_name, start=0)
+        extractor = cls(project_name)
+        issue_ids = extractor.get_issue_ids(start=0)
         while issue_ids:
             for issue_id in sorted(issue_ids):
                 try:
@@ -161,10 +162,10 @@ class GoogleCodeProjectExtractor(ProjectExtractor):
                         raise
             # get any new issues that were created while importing
             # (jumping back a few in case some were deleted and new ones added)
-            new_ids = cls.get_issue_ids(project_name, start=len(issue_ids)-10)
+            new_ids = extractor.get_issue_ids(start=len(issue_ids)-10)
             issue_ids = new_ids - issue_ids
 
-    def get_issue_ids(self, project_name, start=0):
+    def get_issue_ids(self, start=0):
         limit = 100
 
         issue_ids = set()

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/b4945f09/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 296f12d..c2c800a 100644
--- a/ForgeImporters/forgeimporters/tests/google/test_extractor.py
+++ b/ForgeImporters/forgeimporters/tests/google/test_extractor.py
@@ -292,7 +292,7 @@ class TestGoogleCodeProjectExtractor(TestCase):
     def test_get_issue_ids(self):
         extractor = google.GoogleCodeProjectExtractor(None)
         extractor.get_page = mock.Mock(side_effect=((1, 2, 3),(2, 3, 4), ()))
-        self.assertItemsEqual(extractor.get_issue_ids('foo', start=10), (1, 2, 3, 4))
+        self.assertItemsEqual(extractor.get_issue_ids(start=10), (1, 2, 3, 4))
         self.assertEqual(extractor.get_page.call_count, 3)
         extractor.get_page.assert_has_calls([
                 mock.call('issues_csv', parser=google.csv_parser, start=10),
@@ -307,8 +307,8 @@ class TestGoogleCodeProjectExtractor(TestCase):
         issue_ids = [i for i,e in list(google.GoogleCodeProjectExtractor.iter_issues('foo'))]
         self.assertEqual(issue_ids, [1, 2, 3, 4])
         get_issue_ids.assert_has_calls([
-                mock.call('foo', start=0),
-                mock.call('foo', start=-8),
+                mock.call(start=0),
+                mock.call(start=-8),
             ])
 
     @mock.patch.object(google.GoogleCodeProjectExtractor, '__init__')
@@ -317,6 +317,7 @@ class TestGoogleCodeProjectExtractor(TestCase):
         get_issue_ids.side_effect = [set([1, 2, 3, 4, 5])]
         __init__.side_effect = [
                 None,
+                None,
                 HTTPError('fourohfour', 404, 'fourohfour', {}, mock.Mock()),  # should skip
but keep going
                 None,
                 HTTPError('fubar', 500, 'fubar', {}, mock.Mock()),  # should be re-raised


Mime
View raw message