feat: complete production workflow migration
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import unittest
|
||||
|
||||
from db import build_pg_config
|
||||
|
||||
|
||||
class DatabaseConfigTests(unittest.TestCase):
|
||||
def test_complete_config_is_parsed(self):
|
||||
config = build_pg_config(
|
||||
{
|
||||
"PG_HOST": "db.example.test",
|
||||
"PG_PORT": "5544",
|
||||
"PG_DB": "warehouse",
|
||||
"PG_USER": "collector",
|
||||
"PG_PASSWORD": "secret",
|
||||
}
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
config,
|
||||
{
|
||||
"host": "db.example.test",
|
||||
"port": 5544,
|
||||
"dbname": "warehouse",
|
||||
"user": "collector",
|
||||
"password": "secret",
|
||||
},
|
||||
)
|
||||
|
||||
def test_missing_final_config_is_rejected(self):
|
||||
with self.assertRaisesRegex(RuntimeError, "PG_HOST"):
|
||||
build_pg_config(
|
||||
{
|
||||
"PG_PORT": "5432",
|
||||
"PG_DB": "warehouse",
|
||||
"PG_USER": "collector",
|
||||
"PG_PASSWORD": "secret",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user