Example #1
0
 def test_delete_dag_existing_file(self):
     # Test to check that the DAG should be deleted even if
     # the file containing it is not deleted
     DM = DagModel
     key = "my_dag_id"
     session = settings.Session()
     with tempfile.NamedTemporaryFile() as f:
         session.add(DM(dag_id=key, fileloc=f.name))
         session.commit()
         cli.delete_dag(self.parser.parse_args([
             'dags', 'delete', key, '--yes']))
         self.assertEqual(session.query(DM).filter_by(dag_id=key).count(), 0)
Example #2
0
 def test_delete_dag(self):
     DM = DagModel
     key = "my_dag_id"
     session = settings.Session()
     session.add(DM(dag_id=key))
     session.commit()
     cli.delete_dag(self.parser.parse_args(['dags', 'delete', key,
                                            '--yes']))
     self.assertEqual(session.query(DM).filter_by(dag_id=key).count(), 0)
     self.assertRaises(
         AirflowException, cli.delete_dag,
         self.parser.parse_args(
             ['dags', 'delete', 'does_not_exist_dag', '--yes']))