Example #1
0
def test_get_revision_id(ti):
    """Test that get revision id follows desired exits"""
    dco = DeploymentConfigurationOperator(main_dag_name="main",
                                          shipyard_conf="shipyard.conf",
                                          task_id="t1")
    ti = airflow.models.TaskInstance(task=mock.MagicMock(),
                                     execution_date=None)
    rid = dco.get_revision_id(ti)
    assert rid == 2
Example #2
0
def test_get_revision_id_none(ti):
    """Test that get revision id follows desired exits"""
    dco = DeploymentConfigurationOperator(main_dag_name="main",
                                          shipyard_conf="shipyard.conf",
                                          task_id="t1")
    ti = airflow.models.TaskInstance(task=mock.MagicMock(), execution_date="o")
    with pytest.raises(AirflowException) as expected_exc:
        rid = dco.get_revision_id(ti)
    assert "Design_revision is not set." in str(expected_exc)