summaryrefslogtreecommitdiff
path: root/scripts/sync_package_status_unittest.py
diff options
context:
space:
mode:
authorMatt Tennant <mtennant@chromium.org>2012-05-14 09:55:01 -0700
committerGerrit <chrome-bot@google.com>2012-05-17 09:40:40 -0700
commit42aaa8c30897a54ee0bbdef06396b02d9947a7d5 (patch)
tree05a1d5908d4de42a3946e2a3a6d1dbc266f90f3a /scripts/sync_package_status_unittest.py
parent909469c5c6eafb66a3a9a66f25040a24829e12c7 (diff)
downloadchromite-42aaa8c30897a54ee0bbdef06396b02d9947a7d5.tar.gz
sync_package_status: fix bug in determining index of Tracker column.
All runs of sync_package_status were failing to write to the spreadsheet, but really the problem was that it did not have a valid index for the Tracker column in the spreadsheet. Since this script only ever writes to that column the issue seemed like a general write problem, but it was not. The lookup of the Tracker column simply needed to change the name from "Tracker" to "tracker" before looking it up, as it does in other calls to the spreadsheet API. BUG=chromium-os:30779 TEST=`sync_package_status --owner=mtennant` runs through now, creating issues for outdated packages and inserting links into spreadsheet. TEST=`python sync_package_status_unittest.py` passes TEST=pylint of all files passes Change-Id: I7b1c75b3563d907a35c4b3c21509580b7d999c36 Reviewed-on: https://gerrit.chromium.org/gerrit/22584 Tested-by: Matt Tennant <mtennant@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Commit-Ready: Matt Tennant <mtennant@chromium.org>
Diffstat (limited to 'scripts/sync_package_status_unittest.py')
-rw-r--r--scripts/sync_package_status_unittest.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/sync_package_status_unittest.py b/scripts/sync_package_status_unittest.py
index 5e3ab2091..963c439b6 100644
--- a/scripts/sync_package_status_unittest.py
+++ b/scripts/sync_package_status_unittest.py
@@ -204,6 +204,21 @@ class SyncerTest(test_lib.MoxTestCase):
self.assertEquals(test['result'], result, msg)
self.mox.VerifyAll()
+ def testSyncMissingTrackerColumn(self):
+ mocked_syncer = self.mox.CreateMock(sps.Syncer)
+ mocked_scomm = self.mox.CreateMock(gdata_lib.SpreadsheetComm)
+ mocked_tcomm = self.mox.CreateMock(gdata_lib.TrackerComm)
+ mocked_syncer.scomm = mocked_scomm
+ mocked_syncer.tcomm = mocked_tcomm
+
+ # Replay script
+ mocked_scomm.GetColumnIndex(sps.COL_TRACKER).AndReturn(None)
+ self.mox.ReplayAll()
+
+ # Verify
+ self.assertRaises(sps.SyncError, sps.Syncer.Sync, mocked_syncer)
+ self.mox.VerifyAll()
+
def testSyncNewIssues(self):
mocked_syncer = self.mox.CreateMock(sps.Syncer)
mocked_scomm = self.mox.CreateMock(gdata_lib.SpreadsheetComm)
@@ -217,7 +232,7 @@ class SyncerTest(test_lib.MoxTestCase):
]
# Replay script
- mocked_scomm.GetColumnIndex('Tracker')
+ mocked_scomm.GetColumnIndex(sps.COL_TRACKER).AndReturn(1) # Any index ok.
mocked_scomm.GetRows().AndReturn(rows)
for ix in xrange(len(rows)):
@@ -244,7 +259,7 @@ class SyncerTest(test_lib.MoxTestCase):
]
# Replay script
- mocked_scomm.GetColumnIndex('Tracker')
+ mocked_scomm.GetColumnIndex(sps.COL_TRACKER).AndReturn(1) # Any index ok.
mocked_scomm.GetRows().AndReturn(rows)
for ix in xrange(len(rows)):
@@ -271,7 +286,7 @@ class SyncerTest(test_lib.MoxTestCase):
]
# Replay script
- mocked_scomm.GetColumnIndex('Tracker')
+ mocked_scomm.GetColumnIndex(sps.COL_TRACKER).AndReturn(1) # Any index ok.
mocked_scomm.GetRows().AndReturn(rows)
for ix in xrange(len(rows)):