示例#1
0
 def test_execute(self, mock_base_op, hook_mock):
     profile_id = "PROFILE_ID"
     op = GoogleCampaignManagerBatchUpdateConversionsOperator(
         task_id="update_conversion",
         profile_id=profile_id,
         conversions=[CONVERSION],
         encryption_source="AD_SERVING",
         encryption_entity_type="DCM_ADVERTISER",
         encryption_entity_id=123456789,
     )
     op.execute(None)
     hook_mock.return_value.conversions_batch_update.assert_called_once_with(
         profile_id=profile_id,
         conversions=[CONVERSION],
         encryption_source="AD_SERVING",
         encryption_entity_type="DCM_ADVERTISER",
         encryption_entity_id=123456789,
         max_failed_updates=0,
     )
示例#2
0
    create_report >> run_report >> wait_for_report >> get_report >> delete_report

    # [START howto_campaign_manager_insert_conversions]
    insert_conversion = GoogleCampaignManagerBatchInsertConversionsOperator(
        task_id="insert_conversion",
        profile_id=PROFILE_ID,
        conversions=[CONVERSION],
        encryption_source="AD_SERVING",
        encryption_entity_type="DCM_ADVERTISER",
        encryption_entity_id=ENCRYPTION_ENTITY_ID,
    )
    # [END howto_campaign_manager_insert_conversions]

    # [START howto_campaign_manager_update_conversions]
    update_conversion = GoogleCampaignManagerBatchUpdateConversionsOperator(
        task_id="update_conversion",
        profile_id=PROFILE_ID,
        conversions=[CONVERSION_UPDATE],
        encryption_source="AD_SERVING",
        encryption_entity_type="DCM_ADVERTISER",
        encryption_entity_id=ENCRYPTION_ENTITY_ID,
        max_failed_updates=1,
    )
    # [END howto_campaign_manager_update_conversions]

    insert_conversion >> update_conversion

if __name__ == "__main__":
    dag.clear(dag_run_state=State.NONE)
    dag.run()