Ejemplo n.º 1
0
 def test_magics_without_connected_account(self):
     env = EnvironmentVarGuard()
     env.set('KAGGLE_USER_SECRETS_TOKEN', 'foobar')
     with env:
         import sitecustomize
         sitecustomize.init()
         from google.cloud.bigquery import magics
         self.assertIsNone(magics.context._credentials)
Ejemplo n.º 2
0
 def test_default_credentials_gcs_enabled(self):
     env = EnvironmentVarGuard()
     env.set('KAGGLE_USER_SECRETS_TOKEN', 'foobar')
     env.set('KAGGLE_KERNEL_INTEGRATIONS', 'GCS')
     with env:
         from sitecustomize import init
         init()
         client = storage.Client(project="xyz")
         self.assertIsInstance(client._credentials, KaggleKernelCredentials)
Ejemplo n.º 3
0
 def test_magics_with_connected_account_default_credentials(self):
     env = EnvironmentVarGuard()
     env.set('KAGGLE_USER_SECRETS_TOKEN', 'foobar')
     env.set('KAGGLE_KERNEL_INTEGRATIONS', 'BIGQUERY')
     with env:
         import sitecustomize
         sitecustomize.init()
         from google.cloud.bigquery import magics
         self.assertEqual(type(magics.context._credentials),
                          KaggleKernelCredentials)
         magics.context.credentials = None