def test_pending_patch_date_missing(self, mock_sql): """Ensure None is returned when no patches match.""" testdb = SktDb(self.database_file) mock_sql.connect().cursor().fetchone.return_value = None result = testdb.get_last_pending_patch_date('baseurl', 'project_id') self.assertIsNone(result)
def test_pending_patch_date(self, mock_sql): """Ensure get_last_pending_patch_date() returns a patch id.""" testdb = SktDb(self.database_file) mock_sql.connect().cursor().fetchone.return_value = ['2018-05-31'] result = testdb.get_last_pending_patch_date('baseurl', 'project_id') self.assertEqual(result, '2018-05-31')