def test_get_doc_no_deckhand(): """Get doc should fail to contact deckhand return a document""" dco = DeploymentConfigurationOperator(main_dag_name="main", shipyard_conf="shipyard.conf", task_id="t1") with pytest.raises(AirflowException) as expected_exc: dco.get_doc(99) assert "Failed to retrieve deployment" in str(expected_exc)
def test_get_doc_mock_deckhand_invalid(*args): """Get doc should return a document""" dco = DeploymentConfigurationOperator(main_dag_name="main", shipyard_conf="shipyard.conf", task_id="t1") with pytest.raises(AirflowException) as airflow_ex: dco.get_doc(99) assert 'valid deployment-configuration' in str(airflow_ex)
def test_get_doc_mock_deckhand(*args): """Get doc should return a document""" dco = DeploymentConfigurationOperator(main_dag_name="main", shipyard_conf="shipyard.conf", task_id="t1") dco.config = make_fake_config() doc = dco.get_doc(99) assert doc == 'abcdefg'