From b7ca49b29b053086f09f5fea31ae710c574bdcab Mon Sep 17 00:00:00 2001
From: claudio <claudio.sousa@epfl.ch>
Date: Thu, 8 Nov 2018 15:31:56 +0100
Subject: [PATCH] [NRRPLT-6750] Fix problems with Virtual Coach and private
 experiments

---
 .../hbp_nrp_virtual_coach/tests/test_virtual_coach.py       | 2 +-
 .../hbp_nrp_virtual_coach/virtual_coach.py                  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/tests/test_virtual_coach.py b/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/tests/test_virtual_coach.py
index 3c2509a..5732654 100644
--- a/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/tests/test_virtual_coach.py
+++ b/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/tests/test_virtual_coach.py
@@ -320,7 +320,7 @@ mock-server-5
         mock_response.content = json.dumps(self._mock_exp_list_cloned)
         mock_request.return_value = mock_response
         exp_list = self._vc._VirtualCoach__get_experiment_list(cloned=True)
-        self.assertEqual(exp_list, ['MockExperiment1_0', 'MockExperiment2_0'])
+        self.assertEqual(exp_list, {'MockExperiment2_0': {'uuid': 'MockExperiment2_0', 'name': 'MockExperiment2_0'}, 'MockExperiment1_0': {'uuid': 'MockExperiment1_0', 'name': 'MockExperiment1_0'}})
 
     @patch('getpass.getpass', return_value='password')
     def test_launch_asserts(self, mock_getpass):
diff --git a/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py b/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py
index 10221b8..bfc402c 100644
--- a/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py
+++ b/hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/virtual_coach.py
@@ -159,13 +159,13 @@ class VirtualCoach(object):
         logger.info('List of production%s experiments:', '' if not dev else ' and development')
         print table.draw()
 
-    def print_running_experiments(self):
+    def print_running_experiments(self, cloned=False):
         """
         Prints a table of currently running experiments and relevant details (if any).
         """
 
         # retrieve and parse the current experiment list
-        exp_list = self.__get_experiment_list()
+        exp_list = self.__get_experiment_list(cloned)
 
         # construct a table with minimal useful information
         table = Texttable()
@@ -405,7 +405,7 @@ class VirtualCoach(object):
             response = requests.get(url, headers=headers)
             # return a simple list containing only experiment names since this is the only
             # information in the dictionary anyway
-            return [experiment['name'] for experiment in json.loads(response.content)]
+            return {experiment['name']: experiment for experiment in json.loads(response.content)}
         else:
             _, response = self.__http_client.get(
                 self.__config['proxy-services']['experiment-list'])
-- 
GitLab