|
14 | 14 | from google.api_core.exceptions import DataLoss, InternalServerError, ResourceExhausted, TooManyRequests, Unauthenticated
|
15 | 15 | from grpc import RpcError
|
16 | 16 | from source_google_ads.google_ads import GoogleAds
|
17 |
| -from source_google_ads.streams import ClickView, Customer, CustomerLabel |
| 17 | +from source_google_ads.streams import AdGroup, ClickView, Customer, CustomerLabel |
18 | 18 |
|
19 | 19 | # EXPIRED_PAGE_TOKEN exception will be raised when page token has expired.
|
20 | 20 | exception = GoogleAdsException(
|
@@ -287,3 +287,14 @@ def test_read_records_unauthenticated(mocker, customers, config):
|
287 | 287 | assert exc_info.value.message == (
|
288 | 288 | "Authentication failed for the customer 'customer_id'. " "Please try to Re-authenticate your credentials on set up Google Ads page."
|
289 | 289 | )
|
| 290 | + |
| 291 | + |
| 292 | +def test_ad_group_stream_query_removes_metrics_field_for_manager(customers_manager, customers, config): |
| 293 | + credentials = config["credentials"] |
| 294 | + api = GoogleAds(credentials=credentials) |
| 295 | + stream_config = dict(api=api, customers=customers_manager, start_date="2020-01-01", conversion_window_days=10) |
| 296 | + stream = AdGroup(**stream_config) |
| 297 | + assert "metrics" not in stream.get_query(stream_slice={"customer_id": "123"}) |
| 298 | + stream_config = dict(api=api, customers=customers, start_date="2020-01-01", conversion_window_days=10) |
| 299 | + stream = AdGroup(**stream_config) |
| 300 | + assert "metrics" in stream.get_query(stream_slice={"customer_id": "123"}) |
0 commit comments