2525import unittest
2626
2727import google .auth
28- from docs_mail_merge import _copy_template , get_data , get_http_client
28+ from docs_mail_merge import _copy_template , get_data
2929from googleapiclient import discovery
3030
31+ creds , _ = google .auth .default ()
32+
3133
3234class TestDocsMailMerge (unittest .TestCase ):
3335 'Unit tests for Mail Merge sample'
3436
3537 def test_project (self ):
3638 self .assertTrue (project_test ())
3739
38- def test_gapis (self ):
39- self .assertTrue (gapis_test ())
40-
4140 def test_create_doc (self ):
4241 self .assertTrue (create_doc_test ())
4342
@@ -56,18 +55,9 @@ def project_test():
5655 credentials , project = google .auth .default ()
5756
5857
59- def gapis_test ():
60- 'Tests whether project can connect to all 3 APIs used in the sample.'
61- HTTP = get_http_client ()
62- discovery .build ('drive' , 'v3' , http = HTTP )
63- discovery .build ('docs' , 'v1' , http = HTTP )
64- discovery .build ('sheets' , 'v4' , http = HTTP )
65- return True
66-
67-
6858def create_doc_test ():
6959 'Tests whether project can create and delete a Google Docs file.'
70- DRIVE = discovery .build ('drive' , 'v3' , http = get_http_client () )
60+ DRIVE = discovery .build ('drive' , 'v3' , credentials = creds )
7161 DATA = {
7262 'name' : 'Test Doc' ,
7363 'mimeType' : 'application/vnd.google-apps.document' ,
@@ -79,7 +69,7 @@ def create_doc_test():
7969
8070def copy_doc_test ():
8171 'Tests whether project can copy and delete a Google Docs file.'
82- DRIVE = discovery .build ('drive' , 'v3' , http = get_http_client () )
72+ DRIVE = discovery .build ('drive' , 'v3' , credentials = creds )
8373 DOCS_FILE_ID = '1Xycxuuv7OhEQUuzbt_Mw0TPMq02MseSD1vZdBJ3nLjk'
8474 doc_id = _copy_template (DOCS_FILE_ID , 'text' , DRIVE )
8575 DRIVE .files ().delete (fileId = doc_id , fields = '' ).execute ()
0 commit comments