Add tests for assuming credentials from environment

This commit is contained in:
Anthony Miyaguchi 2019-11-15 13:07:43 -08:00 коммит произвёл Anthony Miyaguchi
Родитель b497a47006
Коммит d084522ec6
1 изменённых файлов: 39 добавлений и 0 удалений

Просмотреть файл

@ -180,6 +180,45 @@ def test_aggregation_cli(tmp_path, monkeypatch, spark):
assert_new_db_functions_backwards_compatible()
def test_aggregation_cli_no_credentials_file(monkeypatch, spark):
class Dataset:
@staticmethod
def from_source(*args, **kwargs):
return Dataset()
def where(self, *args, **kwargs):
return self
def records(self, *args, **kwargs):
return spark.sparkContext.parallelize(generate_pings())
monkeypatch.setattr("mozaggregator.aggregator.Dataset", Dataset)
result = CliRunner().invoke(
run_aggregator,
[
"--date",
SUBMISSION_DATE_1.strftime('%Y%m%d'),
"--channels",
"nightly,beta",
"--num-partitions",
10,
],
env={
"DB_TEST_URL": "",
"POSTGRES_DB": "postgres",
"POSTGRES_USER": "postgres",
"POSTGRES_PASS": "pass",
"POSTGRES_HOST": "db",
"POSTGRES_RO_HOST": "db",
},
catch_exceptions=False,
)
assert result.exit_code == 0, result.output
assert_new_db_functions_backwards_compatible()
@runif_bigquery_testing_enabled
def test_aggregation_cli_bigquery(tmp_path, bq_testing_table):
test_creds = str(tmp_path / "creds")