def testFindCommit_notFound(self): self.subprocess.check_output.return_value = '' date = pd.Timestamp('2019-03-18T00:00:00', tz=pinboard.TZ) return_value = pinboard.FindCommit(after_date=date) self.subprocess.check_output.assert_called_once_with( ['git', 'log', '--max-count', '1', '--format=format:%H:%ct', '--after', '2019-03-18T00:00:00-07:00', 'origin/master'], cwd=pinboard.TOOLS_PERF_DIR) self.assertIsNone(return_value)
def testFindCommit_simple(self): self.subprocess.check_output.return_value = '2a66bac4:1552891816\n' date = pd.Timestamp('2019-03-18T00:00:00', tz=pinboard.TZ) revision, timestamp = pinboard.FindCommit(before_date=date) self.subprocess.check_output.assert_called_once_with( ['git', 'log', '--max-count', '1', '--format=format:%H:%ct', '--before', '2019-03-18T00:00:00-07:00', 'origin/master'], cwd=pinboard.TOOLS_PERF_DIR) self.assertEqual(revision, '2a66bac4') self.assertEqual(timestamp, '2019-03-17T23:50:16-07:00')