def create_booth_env(): if not is_mocked_environment: return {"name": name} return { "name": name, "config_file": env_file.read(config_path), "key_file": env_file.read(key_path, is_binary=True), "key_path": key_path, }
def assert_returns_content(self, content, is_file): self.is_file.return_value = is_file with patch_env_file("open", self.mock_open, create=True): self.assertEqual( content, env_file.read(FILE_PATH) )
def test_exit_when_cannot_open_file(self): self.mock_open.side_effect = EnvironmentError() self.mock_error.side_effect = SystemExit() self.assertRaises(SystemExit, lambda: env_file.read(FILE_PATH))