Skip to content

Commit

Permalink
CLI unit tests, bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Aug 23, 2015
1 parent 6405204 commit 3b35748
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
1 change: 0 additions & 1 deletion airflow/example_dags/example_bash_operator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from builtins import str
from builtins import range
from airflow.operators import BashOperator, DummyOperator
from airflow.models import DAG
Expand Down
1 change: 0 additions & 1 deletion airflow/example_dags/example_python_operator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from __future__ import print_function
from builtins import str
from builtins import range
from airflow.operators import PythonOperator
from airflow.models import DAG
Expand Down
20 changes: 19 additions & 1 deletion tests/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from airflow.www.app import app
from airflow import utils

NUM_EXAMPLE_DAGS = 5
NUM_EXAMPLE_DAGS = 6
DEV_NULL = '/dev/null'
LOCAL_EXECUTOR = executors.LocalExecutor()
DEFAULT_DATE = datetime(2015, 1, 1)
Expand Down Expand Up @@ -164,6 +164,23 @@ def setUp(self):
def test_confirm_unittest_mod(self):
assert configuration.conf.get('core', 'unit_test_mode')

def test_cli(self):
from airflow.bin import cli
parser = cli.get_parser()
args = parser.parse_args(['list_dags'])
cli.list_dags(args)

for dag_id in self.dagbag.dags.keys():
args = parser.parse_args(['list_tasks', dag_id])
cli.list_tasks(args)

args = parser.parse_args(['list_tasks', 'example_bash_operator', '--tree'])
cli.list_tasks(args)

cli.initdb(parser.parse_args(['initdb']))
# cli.upgradedb(parser.parse_args(['upgradedb']))


def test_time_sensor(self):
t = operators.TimeSensor(
task_id='time_sensor_check',
Expand Down Expand Up @@ -349,6 +366,7 @@ def test_dag_views(self):
response = self.app.get(
"/admin/airflow/refresh?dag_id=example_bash_operator")
response = self.app.get("/admin/airflow/refresh_all")
response = self.app.get("/admin/airflow/paused?dag_id=example_python_operator&is_paused=false")

def test_charts(self):
response = self.app.get(
Expand Down

0 comments on commit 3b35748

Please sign in to comment.