From commits-return-73414-archive-asf-public=cust-asf.ponee.io@airflow.apache.org Thu Oct 31 13:52:46 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 9F09B180629 for ; Thu, 31 Oct 2019 14:52:46 +0100 (CET) Received: (qmail 39215 invoked by uid 500); 31 Oct 2019 13:52:46 -0000 Mailing-List: contact commits-help@airflow.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airflow.apache.org Delivered-To: mailing list commits@airflow.apache.org Received: (qmail 39191 invoked by uid 99); 31 Oct 2019 13:52:45 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 31 Oct 2019 13:52:45 +0000 From: GitBox To: commits@airflow.apache.org Subject: [GitHub] [airflow] feluelle commented on a change in pull request #6467: [AIRFLOW-5814] Implementing Presto hook tests Message-ID: <157252996584.6353.16435996580927370775.gitbox@gitbox.apache.org> Date: Thu, 31 Oct 2019 13:52:45 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit feluelle commented on a change in pull request #6467: [AIRFLOW-5814] Implementing Presto hook tests URL: https://github.com/apache/airflow/pull/6467#discussion_r341146585 ########## File path: tests/hooks/test_presto_hook.py ########## @@ -51,3 +51,39 @@ def test_insert_rows(self, mock_insert_rows): target_fields = None self.db_hook.insert_rows(table, rows, target_fields) mock_insert_rows.assert_called_once_with(table, rows, None, 0) + + def test_get_first_record(self): + statement = 'SQL' + result_sets = [('row1',), ('row2',)] + self.cur.fetchone.return_value = result_sets[0] + + self.assertEqual(result_sets[0], self.db_hook.get_first(statement)) + assert self.conn.close.call_count == 1 + assert self.cur.close.call_count == 1 + self.cur.execute.assert_called_once_with(statement) + + def test_get_records(self): + statement = 'SQL' + result_sets = [('row1',), ('row2',)] + self.cur.fetchall.return_value = result_sets + + self.assertEqual(result_sets, self.db_hook.get_records(statement)) + assert self.conn.close.call_count == 1 + assert self.cur.close.call_count == 1 Review comment: And here. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services