def test_exported_password(): """ Test, that the password will be left untouched, if it is already exported """ password = random_pass() os.environ['DOCKER_PASSWORD'] = password pw.getpass.getpass = lambda _: 'not so random' with open('tests/test-config.yml') as conf_file: conf = LauncherConf(conf_file) pw.export_password(conf) assert os.environ['DOCKER_PASSWORD'] == password assert os.environ['DOCKER_PASSWORD'] != 'not so random'
def test_export_password(): """ Test, that the password gets read by getpass, when it can't be found in the environment """ try: del os.environ['DOCKER_PASSWORD'] except: pass password = random_pass() pw.getpass.getpass = lambda _: password with open('tests/test-config.yml') as conf_file: conf = LauncherConf(conf_file) pw.export_password(conf) assert os.environ['DOCKER_PASSWORD'] == password