Skip to content
Snippets Groups Projects
Commit d7a73b26 authored by Jedrzej Rybicki's avatar Jedrzej Rybicki
Browse files

adding test stub

parent 810c16d6
Branches
Tags
No related merge requests found
Pipeline #77452 failed
......@@ -15,6 +15,7 @@ test:
before_script:
- airflow db init
- pip install -r requirements.txt
- pip install nose==1.3.7
- airflow connections add --conn-uri https://b2share-testing.fz-juelich.de/ default_b2share
script:
- ls
......@@ -23,4 +24,5 @@ test:
- airflow dags list
- airflow connections list
- airflow dags test firsto 2021-08-18
- nosetests
import unittest
from airflow.utils.state import State
from dags.b2shareoperator import B2ShareOperator
from airflow import DAG
from airflow.models.taskinstance import TaskInstance
DEFAULT_DATE = '2019-10-03'
TEST_DAG_ID = 'test_my_custom_operator'
class B2ShareOperatorTest(unittest.TestCase):
def setUp(self):
self.dag = DAG(TEST_DAG_ID, schedule_interval='@daily', default_args={'start_date' : DEFAULT_DATE})
self.op = B2ShareOperator(
dag=self.dag,
task_id='test',
)
self.ti = TaskInstance(task=self.op, execution_date=DEFAULT_DATE)
def test_execute_no_trigger(self):
self.ti.run(ignore_ti_state=True)
assert self.ti.state == State.SUCCESS
# Assert something related to tasks results
\ No newline at end of file
from airflow.models import DagBag
import unittest
class TestADag(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dagbag = DagBag()
def test_dag_loaded(self):
dag = self.dagbag.get_dag(dag_id='firsto')
assert self.dagbag.import_errors == {}
assert dag is not None
assert len(dag.tasks) == 1
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment