def _default(self): args = self.app.pargs GDocDown(credentials=self.app.credentials).download( args.google_file, format=args.format, out_path=args.out_path, extension=args.extension)
def test_api_txt(self): GDocDown(credentials=self.credentials).download(self.GDOC_FILE, format='txt', out_path=os.path.join(self.out_dir, 'example-out.text')) # check that file downloaded self.assertTrue(os.path.isfile(os.path.join(self.out_dir, 'example-out.text'))) # check that file has correct content with open(os.path.join(self.out_dir, 'example-out.text'), 'r') as file: self.assertRegex(file.read().strip(), 'gdoc_down example file')
def test_get_credentials(self): with mock.patch.object(oauth2client.file.Storage, 'get', return_value=None): with mock.patch.object(oauth2client.tools, 'run_flow', return_value=self.credentials): gdoc_down = GDocDown() self.assertEqual(gdoc_down.credentials, self.credentials)