def test_filters__env(self):
    with mktemp('user_login: kolypto') as yml_file:
        with mktemp('{{ user_login }}:{{ "USER_PASS"|env }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict(USER_PASS='qwerty123'))
            assert ('USER_PASS' not in os.environ)
            with self.assertRaises(KeyError):
                self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict())
        with mktemp('{{ user_login }}:{{ "USER_PASS"|env("-none-") }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:-none-', env=dict())
        with mktemp('{{ user_login }}:{{ env("USER_PASS") }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict(USER_PASS='qwerty123'))
            with self.assertRaises(KeyError):
                self._testme(['--format=yaml', template, yml_file], '', env=dict())
        with mktemp('{{ user_login }}:{{ env("USER_PASS", "-none-") }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict(USER_PASS='qwerty123'))
            self._testme(['--format=yaml', template, yml_file], 'kolypto:-none-', env=dict())
def test_filters__env(self):
    with mktemp('user_login: kolypto') as yml_file:
        with mktemp('{{ user_login }}:{{ "USER_PASS"|env }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict(USER_PASS='qwerty123'))
            assert ('USER_PASS' not in os.environ)
            with self.assertRaises(KeyError):
                self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict())
        with mktemp('{{ user_login }}:{{ "USER_PASS"|env("-none-") }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:-none-', env=dict())
        with mktemp('{{ user_login }}:{{ env("USER_PASS") }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict(USER_PASS='qwerty123'))
            with self.assertRaises(KeyError):
                self._testme(['--format=yaml', template, yml_file], , env=dict())
        with mktemp('{{ user_login }}:{{ env("USER_PASS", "-none-") }}') as template:
            self._testme(['--format=yaml', template, yml_file], 'kolypto:qwerty123', env=dict(USER_PASS='qwerty123'))
            self._testme(['--format=yaml', template, yml_file], 'kolypto:-none-', env=dict())