joppevos commented on pull request #8808:
URL: https://github.com/apache/airflow/pull/8808#issuecomment-628489425
Added the feedback. The only thing I have to make now is the test. I assume
the test would check if it is able to work correctly given a YAML or JSON build
config. How would I approach this? Something like the code below? New to
testing to be honest.
I appreciate the given help @mik-laj.
```
@mock.patch("airflow.providers.google.cloud.operators.cloud_build.CloudBuildHook")
def test_load_yaml(self, hook_mock):
with tempfile.NamedTemporaryFile(suffix='.yaml', mode='w+t') as
build:
build.writelines("""
steps:
- name: 'ubuntu'
args: ['echo', 'hello world, the day is {{ ds }} ']
""")
body_path = build.name
operator = CloudBuildCreateOperator(
body=body_path, project_id=TEST_PROJECT_ID, task_id="task-id"
)
return_value = operator.execute({})
# TODO: assert given yaml values are same as return
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]