Ejemplo n.º 1
0
 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,
     }
Ejemplo n.º 2
0
 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)
         )
Ejemplo n.º 3
0
 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)
         )
Ejemplo n.º 4
0
 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))