Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix asset test comments from PR #987 #1009

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 3 commits into
base: main
Choose a base branch
from

Conversation

bobhancockg
Copy link
Contributor

@bobhancockg bobhancockg commented Jun 13, 2025

Address comments on asset examples tests PR

Update asset examples to v20 and refresh copyright

This commit incorporates your feedback to:

  1. Ensure all asset example scripts in examples/assets/ and their corresponding tests in examples/assets/tests/ are aligned with API version v20.
  2. Update the copyright year to 2025 in the license headers for these files.

The noxfile.py was previously updated to discover and run tests from examples/assets/tests/.
The .gitkeep file in examples/assets/tests/ was removed as it's no longer necessary.
License headers were added to all new test files in examples/assets/tests/.

All tests were run successfully after these changes.

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.
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/.
@bobhancockg bobhancockg requested a review from BenRKarl June 13, 2025 17:09
@bobhancockg bobhancockg requested a review from a team as a code owner June 13, 2025 17:09
@bobhancockg bobhancockg requested a review from sundquist June 13, 2025 17:09
This commit incorporates your feedback to:

1. Ensure all asset example scripts in `examples/assets/` and their corresponding tests in `examples/assets/tests/` are aligned with API version v20.
2. Update the copyright year to 2025 in the license headers for these files.

The `noxfile.py` was previously updated to discover and run tests from `examples/assets/tests/`.
The `.gitkeep` file in `examples/assets/tests/` was removed as it's no longer necessary.
License headers were added to all new test files in `examples/assets/tests/`.

All tests were run successfully after these changes.
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.

1 participant