8000 Gold tests assets by bobhancockg · Pull Request #987 · googleads/google-ads-python · GitHub
[go: up one dir, main page]

Skip to content

Gold tests assets #987

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Gold tests assets #987

wants to merge 2 commits into from

Conversation

bobhancockg
Copy link
Contributor

This commit introduces a test suite for the Python scripts located in the examples/assets directory. Unit tests have been created for each script, mocking the GoogleAdsClient and associated services to verify the core functionality and API interactions.

The tests cover:

  • add_call.py
  • add_hotel_callout.py
  • add_lead_form_asset.py
  • add_prices.py
  • add_sitelinks.py
  • upload_image_asset.py

Key aspects verified:

  • Correct creation and configuration of various asset types.
  • Proper linking of assets to accounts or campaigns.
  • Appropriate parameters being passed to API service calls.

The scripts themselves instantiate the GoogleAdsClient using version="v19". While directly testing the if __name__ == "__main__": block for the load_from_storage call proved challenging,
the tests for the main functional logic of each script operate under the assumption of a v19 client, and the client instantiation in the scripts confirms this version usage.

__init__.py files have been added to relevant directories to ensure proper test discovery.

@bobhancockg bobhancockg requested a review from a team as a code owner May 31, 2025 16:06
@bobhancockg bobhancockg requested review from AnashOommen and sundquist and removed request for AnashOommen and sundquist May 31, 2025 16:06
@bobhancockg bobhancockg changed the title Gold Add test suite for examples/assets and confirm v19 API usage. Gold tests assets Jun 2, 2025
@BenRKarl BenRKarl added the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 5, 2025
@kokoro-team kokoro-team removed the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 5, 2025
@BenRKarl BenRKarl added the kokoro:force-run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 5, 2025
This commit introduces a test suite for the Python scripts located in the
`examples/assets` directory. Unit tests have been created for each script,
mocking the GoogleAdsClient and associated services to verify the core
functionality and API interactions.

The tests cover:
- `add_call.py`
- `add_hotel_callout.py`
- `add_lead_form_asset.py`
- `add_prices.py`
- `add_sitelinks.py`
- `upload_image_asset.py`

Key aspects verified:
- Correct creation and configuration of various asset types.
- Proper linking of assets to accounts or campaigns.
- Appropriate parameters being passed to API service calls.

The scripts themselves instantiate the GoogleAdsClient using `version="v19"`.
While directly testing the `if __name__ == "__main__":` block for the
`load_from_storage` call proved challenging,
the tests for the main functional logic of each script operate under the
assumption of a v19 client, and the client instantiation in the scripts
confirms this version usage.

`__init__.py` files have been added to relevant directories to ensure
proper test discovery.
@BenRKarl BenRKarl force-pushed the feat/asset-examples-tests-v19 branch from ece5e65 to b32439e Compare June 10, 2025 19:33
@BenRKarl BenRKarl added kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. and removed kokoro:force-run This label is required to run a kokoro presubmit if an external contributor sends a PR. labels Jun 10, 2025
@kokoro-team kokoro-team removed the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 10, 2025
Copy link
Contributor
@BenRKarl BenRKarl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will these tests get executed? Does nox find them automatically?

bobhancockg pushed a commit that referenced this pull request Jun 13, 2025
This commit addresses the following comments from PR #987:

- Modifies noxfile.py to ensure that tests in examples/assets/tests/ are discovered and executed.
- Removes the .gitkeep file from examples/assets/tests/ as it's no longer necessary due to the addition of test files.
- Adds the standard Apache 2.0 license header to all new test files in examples/assets/tests/.
and get them to work.

Change-Id: Ie06bd9c015987ce27c0b8c9aafddd695c3a57b11
@BenRKarl BenRKarl added the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 18, 2025
@kokoro-team kokoro-team removed the kokoro:run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0