|
19 | 19 | import pandas.util.testing as tm
|
20 | 20 | from pandas.compat.numpy import np_datetime64_compat
|
21 | 21 |
|
22 |
| -PROJECT_ID = None |
23 |
| -PRIVATE_KEY_JSON_PATH = None |
24 |
| -PRIVATE_KEY_JSON_CONTENTS = None |
| 22 | +PROJECT_ID = os.environ.get('PROJECT_ID') |
| 23 | +PRIVATE_KEY_JSON_PATH = 'client_secrets.json' |
| 24 | +PRIVATE_KEY_JSON_CONTENTS = os.environ.get('SERVICE_ACCOUNT_KEY') |
| 25 | +# PROJECT_ID = None |
| 26 | +# PRIVATE_KEY_JSON_PATH = None |
| 27 | +# PRIVATE_KEY_JSON_CONTENTS = None |
25 | 28 |
|
26 | 29 | TABLE_ID = 'new_test'
|
27 | 30 |
|
@@ -309,6 +312,7 @@ def test_get_application_default_credentials_returns_credentials(self):
|
309 | 312 |
|
310 | 313 |
|
311 | 314 | class TestGBQConnectorIntegrationWithServiceAccountKeyPath(tm.TestCase):
|
| 315 | + |
312 | 316 | def setUp(self):
|
313 | 317 | _setup_common()
|
314 | 318 |
|
@@ -340,6 +344,7 @@ def test_should_be_able_to_get_results_from_query(self):
|
340 | 344 |
|
341 | 345 |
|
342 | 346 | class TestGBQConnectorIntegrationWithServiceAccountKeyContents(tm.TestCase):
|
| 347 | + |
343 | 348 | def setUp(self):
|
344 | 349 | _setup_common()
|
345 | 350 |
|
@@ -1275,6 +1280,18 @@ def test_verify_schema_ignores_field_mode(self):
|
1275 | 1280 | self.dataset_prefix + "1", TABLE_ID + test_id, test_schema_2),
|
1276 | 1281 | 'Expected schema to match')
|
1277 | 1282 |
|
| 1283 | + def test_retrieve_schema(self): |
| 1284 | + test_id = "15" |
| 1285 | + test_schema = {'fields': [{'name': 'A', 'type': 'FLOAT'}, |
| 1286 | + {'name': 'B', 'type': 'FLOAT'}, |
| 1287 | + {'name': 'C', 'type': 'STRING'}, |
| 1288 | + {'name': 'D', 'type': 'TIMESTAMP'}]} |
| 1289 | + |
| 1290 | + self.table.create(TABLE_ID + test_id, test_schema) |
| 1291 | + actual = self.sut.schema(self.dataset_prefix + "1", TABLE_ID + test_id) |
| 1292 | + expected = test_schema['fields'] |
| 1293 | + assert expected == actual, 'Expected schema used to create table' |
| 1294 | + |
1278 | 1295 | def test_list_dataset(self):
|
1279 | 1296 | dataset_id = self.dataset_prefix + "1"
|
1280 | 1297 | self.assertTrue(dataset_id in self.dataset.datasets(),
|
|
0 commit comments