@@ -252,6 +252,8 @@ class AdWordsClientTest(unittest.TestCase):
252252 """Tests for the googleads.adwords.AdWordsClient class."""
253253
254254 def setUp (self ):
255+ self .load_from_storage_path = os .path .join (
256+ os .path .dirname (__file__ ), 'test_data/adwords_googleads.yaml' )
255257 self .https_proxy_host = 'myproxy'
256258 self .https_proxy_port = 443
257259 self .proxy_config = GetProxyConfig (https_host = self .https_proxy_host ,
@@ -264,13 +266,9 @@ def setUp(self):
264266 self .adwords_client , CURRENT_VERSION )
265267
266268 def testLoadFromStorage (self ):
267- with mock .patch ('googleads.common.LoadFromStorage' ) as mock_load :
268- mock_load .return_value = {
269- 'developer_token' : 'abcdEFghIjkLMOpqRs' ,
270- 'oauth2_client' : mock .Mock (),
271- 'user_agent' : 'unit testing'
272- }
273- self .assertIsInstance (googleads .adwords .AdWordsClient .LoadFromStorage (),
269+ with mock .patch ('googleads.oauth2.GoogleRefreshTokenClient.Refresh' ):
270+ self .assertIsInstance (googleads .adwords .AdWordsClient .LoadFromStorage (
271+ path = self .load_from_storage_path ),
274272 googleads .adwords .AdWordsClient )
275273
276274 def testLoadFromStorageWithNonASCIIUserAgent (self ):
@@ -446,30 +444,32 @@ def setUp(self):
446444 def setUpClass (cls ):
447445 test_dir = os .path .dirname (__file__ )
448446 with open (os .path .join (
449- test_dir , 'data /batch_job_util_budget_template.txt' )) as handler :
447+ test_dir , 'test_data /batch_job_util_budget_template.txt' )) as handler :
450448 cls .BUDGET_TEMPLATE = handler .read ()
451449 with open (os .path .join (
452450 test_dir ,
453- 'data /batch_job_util_campaign_criterion_template.txt' )) as handler :
451+ 'test_data /batch_job_util_campaign_criterion_template.txt' )) as handler :
454452 cls .CAMPAIGN_CRITERION_TEMPLATE = handler .read ()
455453 with open (os .path .join (
456454 test_dir ,
457- 'data /batch_job_util_campaign_label_template.txt' )) as handler :
455+ 'test_data /batch_job_util_campaign_label_template.txt' )) as handler :
458456 cls .CAMPAIGN_LABEL_TEMPLATE = handler .read ()
459457 with open (os .path .join (
460- test_dir , 'data /batch_job_util_invalid_request.txt' )) as handler :
458+ test_dir , 'test_data /batch_job_util_invalid_request.txt' )) as handler :
461459 cls .INVALID_API_REQUEST = handler .read ()
462460 with open (os .path .join (
463- test_dir , 'data /batch_job_util_not_request.txt' )) as handler :
461+ test_dir , 'test_data /batch_job_util_not_request.txt' )) as handler :
464462 cls .NOT_API_REQUEST = handler .read ()
465463 with open (os .path .join (
466- test_dir , 'data/batch_job_util_raw_request_template.txt' )) as handler :
464+ test_dir , 'test_data/batch_job_util_raw_request_template.txt' )
465+ ) as handler :
467466 cls .RAW_API_REQUEST_TEMPLATE = handler .read ()
468467 with open (os .path .join (
469- test_dir , 'data/batch_job_util_operations_template.txt' )) as handler :
468+ test_dir , 'test_data/batch_job_util_operations_template.txt' )
469+ ) as handler :
470470 cls .OPERATIONS_TEMPLATE = handler .read ()
471471 with open (os .path .join (
472- test_dir , 'data /batch_job_util_upload_template.txt' )) as handler :
472+ test_dir , 'test_data /batch_job_util_upload_template.txt' )) as handler :
473473 cls .UPLOAD_OPERATIONS_TEMPLATE = handler .read ()
474474
475475 def ExpandOperandTemplate (self , operation_type , operand ):
@@ -1254,7 +1254,7 @@ def setUp(self):
12541254 def setUpClass (cls ):
12551255 test_dir = os .path .dirname (__file__ )
12561256 with open (os .path .join (
1257- test_dir , 'data /batch_job_util_response_template.txt' )) as handler :
1257+ test_dir , 'test_data /batch_job_util_response_template.txt' )) as handler :
12581258 cls .API_RESPONSE_XML_TEMPLATE = handler .read ()
12591259
12601260 def testParseResponse (self ):
0 commit comments