Add tests for environ in template

pull/3/head
Christophe Mehay 8 years ago
parent a2f3864e22
commit 8ca90451f9

@ -168,7 +168,7 @@ You have 4 available objects in your templates.
- `config`
- `links`
- `containers`
- `environ`
- `env`
#### config
@ -213,7 +213,10 @@ You have 4 available objects in your templates.
- Tuple of `link` object related to this container
#### environ
`env` is the environment of the container (os.environ).
`environ` is the environment of the container (os.environ).
`env` is an alias to `environ`.
## Setup

@ -54,6 +54,7 @@ class Entrypoint(object):
f.write(temp.render(config=self.config,
links=self.config.links,
env=os.environ,
environ=os.environ,
containers=DockerLinks().to_containers()))
def run_conf_cmd(self, cmd):

@ -137,6 +137,10 @@ def test_templates():
for id in test['ID']:
int(id, base=16)
# test env
assert test['ENV']['SECRET'] == 'nothing'
assert test['ENVIRON']['SECRET'] == 'nothing'
def test_conf_commands():
entry = Entrypoint(conf='configs/base.yml')

@ -42,3 +42,13 @@ ID:
{% for container in containers %}
- {{container.id}}
{% endfor %}
ENV:
{% for e in env %}
{{e}}: {{env[e]}}
{% endfor %}
ENVIRON:
{% for e in environ %}
{{e}}: {{env[e]}}
{% endfor %}

Loading…
Cancel
Save