Bug #25908
open
- Status changed from New to In progress
- Assignee set to Alexis Mousset
Tested behavior with:
import os
import unittest
from pprint import pprint
def env(option):
if option.startswith("env:"):
env_option = option.split(":", 1)[1]
env_var = env_option.split("=", 1)
if len(env_var) == 2:
return env_var
# os.environ[env_var[0]] = env_var[1]
else:
return None
class TestEnvOption(unittest.TestCase):
def test_upper(self):
self.assertEqual(env(""), None)
self.assertEqual(env("--ignore"), None)
self.assertEqual(env("env:"), None)
self.assertEqual(env("env:NAME"), None)
self.assertEqual(env("env:NAME=VALUE"), ["NAME", "VALUE"])
# allow unsetting a variable
self.assertEqual(env("env:NAME="), ["NAME", ""])
self.assertEqual(env("env:NAME=VALUE=PLOP"), ["NAME", "VALUE=PLOP"])
if __name__ == "__main__":
unittest.main()
- Status changed from In progress to Pending technical review
- Assignee changed from Alexis Mousset to Félix DALLIDET
- Pull Request set to https://github.com/Normation/ncf/pull/1436
- Target version changed from 8.1.9 to 8.1.10
- Target version changed from 8.1.10 to 8.1.11
Also available in: Atom
PDF