File: utils_test.py

package info (click to toggle)
docker-pycreds 0.4.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: python: 264; makefile: 6
file content (22 lines) | stat: -rw-r--r-- 526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import os

from dockerpycreds.utils import create_environment_dict

try:
    from unittest import mock
except ImportError:
    import mock


@mock.patch.dict(os.environ)
def test_create_environment_dict():
    base = {'FOO': 'bar', 'BAZ': 'foobar'}
    os.environ = base
    assert create_environment_dict({'FOO': 'baz'}) == {
        'FOO': 'baz', 'BAZ': 'foobar',
    }
    assert create_environment_dict({'HELLO': 'world'}) == {
        'FOO': 'bar', 'BAZ': 'foobar', 'HELLO': 'world',
    }

    assert os.environ == base