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

Skip to content

Gold tests authentication #988

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 1 commit into
base: main
Choose a base branch
from
Open

Conversation

bobhancockg
Copy link
Contributor

This commit introduces a unit test suite for the generate_user_credentials.py script located in examples/authentication/.

Key changes:

  • Created a new directory examples/authentication/tests/ to house the tests.
  • Added __init__.py to the new tests directory to make it a Python package.
  • Implemented test_generate_user_credentials.py with comprehensive unit tests for the main, get_authorization_code, parse_raw_query_params functions, and the script's command-line argument parsing logic.
  • Utilized mocking extensively to isolate the script's logic from external dependencies such as network operations (sockets) and the OAuth2 flow.

The Google Ads API client library allows specifying the API version (e.g., "v19") during client instantiation (GoogleAdsClient.load_from_storage(version="v19")). The added tests for generate_user_credentials.py do not require direct client instantiation as the script focuses on credential generation, but any API calls made in other examples or within a testing environment for these credentials would use the specified API version.

This commit introduces a unit test suite for the `generate_user_credentials.py`
script located in `examples/authentication/`.

Key changes:
- Created a new directory `examples/authentication/tests/` to house the tests.
- Added `__init__.py` to the new tests directory to make it a Python package.
- Implemented `test_generate_user_credentials.py` with comprehensive unit tests
  for the `main`, `get_authorization_code`, `parse_raw_query_params` functions,
  and the script's command-line argument parsing logic.
- Utilized mocking extensively to isolate the script's logic from external
  dependencies such as network operations (sockets) and the OAuth2 flow.

The Google Ads API client library allows specifying the API version (e.g., "v19")
during client instantiation (`GoogleAdsClient.load_from_storage(version="v19")`).
The added tests for `generate_user_credentials.py` do not require direct
client instantiation as the script focuses on credential generation, but any
API calls made in other examples or within a testing environment for these
credentials would use the specified API version.
@bobhancockg bobhancockg requested a review from a team as a code owner May 31, 2025 16:47
@bobhancockg bobhancockg requested review from BenRKarl and laurachevalier4 and removed request for laurachevalier4 May 31, 2025 16:47
@bobhancockg bobhancockg changed the title Gold feat: Add test suite for authentication examples and ensure v19 usage Gold tests authentication 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
@kokoro-team kokoro-team removed the kokoro:force-run This label is required to run a kokoro presubmit if an external contributor sends a PR. label Jun 5, 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