def test_env_to_dict(self): env = Env() env.set('first', 'Derrick', 'section') env.set('last', 'Wippler', 'section') env.set('no-export', 'wat', 'section', export=False) expected = {'first': 'Derrick', 'last': 'Wippler'} self.assertEqual(env.to_dict(), expected)
def test_env(self): env = Env() env.set('first', 'Derrick', 'section') env.set('last', 'Wippler', 'section') env.set('string', 'My name is ${first} ${last}', 'section') env.eval() self.assertEqual(env['string'].value, "My name is Derrick Wippler") self.assertEqual(env['string'].section, "section")
def test_run(self): env = run('echo "USER=thrawn\nSHELL=bash"', Env()) self.assertIn('USER', env) self.assertIn('SHELL', env)