refactor loading .env file

This commit is contained in:
debugtalk
2018-08-07 15:06:08 +08:00
parent aaac5ba323
commit 167fc9cc02
5 changed files with 34 additions and 11 deletions

View File

@@ -17,6 +17,15 @@ class TestUtils(ApiServerUnittest):
"/post/123"
)
def test_set_os_environ(self):
self.assertNotIn("abc", os.environ)
variables_mapping = {
"abc": "123"
}
utils.set_os_environ(variables_mapping)
self.assertIn("abc", os.environ)
self.assertEqual(os.environ["abc"], "123")
def test_query_json(self):
json_content = {
"ids": [1, 2, 3, 4],