Repository: incubator-airflow
Updated Branches:
  refs/heads/master 6be02475f -> 21c142051


[AIRFLOW-1208] Speed-up cli tests

Closes #2301 from skudriashev/airflow-1208


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/21c14205
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/21c14205
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/21c14205

Branch: refs/heads/master
Commit: 21c14205170610fbb2c17332d4c2f24db14e20db
Parents: 6be0247
Author: Stanislav Kudriashev <stas.kudrias...@gmail.com>
Authored: Wed Jun 7 09:14:00 2017 +0200
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Wed Jun 7 09:14:00 2017 +0200

----------------------------------------------------------------------
 tests/core.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/21c14205/tests/core.py
----------------------------------------------------------------------
diff --git a/tests/core.py b/tests/core.py
index d0b9a97..8ccd4e7 100644
--- a/tests/core.py
+++ b/tests/core.py
@@ -1067,9 +1067,7 @@ class CliTests(unittest.TestCase):
         app = application.create_app()
         app.config['TESTING'] = True
         self.parser = cli.CLIFactory.get_parser()
-        self.dagbag = models.DagBag(
-            dag_folder=DEV_NULL, include_examples=True)
-        # Persist DAGs
+        self.dagbag = models.DagBag(dag_folder=DEV_NULL, include_examples=True)
 
     def test_cli_list_dags(self):
         args = self.parser.parse_args(['list_dags', '--report'])
@@ -1084,12 +1082,18 @@ class CliTests(unittest.TestCase):
             'list_tasks', 'example_bash_operator', '--tree'])
         cli.list_tasks(args)
 
-    def test_cli_initdb(self):
+    @mock.patch("airflow.bin.cli.db_utils.initdb")
+    def test_cli_initdb(self, initdb_mock):
         cli.initdb(self.parser.parse_args(['initdb']))
 
-    def test_cli_resetdb(self):
+        initdb_mock.assert_called_once_with()
+
+    @mock.patch("airflow.bin.cli.db_utils.resetdb")
+    def test_cli_resetdb(self, resetdb_mock):
         cli.resetdb(self.parser.parse_args(['resetdb', '--yes']))
 
+        resetdb_mock.assert_called_once_with()
+
     def test_cli_connections_list(self):
         with mock.patch('sys.stdout',
                         new_callable=six.StringIO) as mock_stdout:

Reply via email to