Exemplo n.º 1
0
 def test_call_and_login(self, mock_token):
     with self.assertRaises(Exception) as exc:
         mock_token.return_value = mock.MagicMock(
             status_code=401, text='Authentication has failed')
         DS8KDriver(**ACCESS_INFO).rest_handler.login()
     self.assertEqual('Invalid username or password.', str(exc.exception))
     RestHandler.login = mock.Mock(return_value=None)
     mock_token.return_value = mock.MagicMock(status_code=401)
     DS8KDriver(**ACCESS_INFO).rest_handler.call('')
Exemplo n.º 2
0
 def test_list_list_controllers(self, mock_contrl):
     RestHandler.login = mock.Mock(return_value=None)
     mock_contrl.return_value = GET_ALL_CONTROLLERS
     controller = DS8KDriver(**ACCESS_INFO).list_controllers(context)
     self.assertEqual(controller, contrl_result)
Exemplo n.º 3
0
 def test_list_ports(self, mock_port):
     RestHandler.login = mock.Mock(return_value=None)
     mock_port.return_value = GET_ALL_PORTS
     port = DS8KDriver(**ACCESS_INFO).list_ports(context)
     self.assertEqual(port, port_result)
Exemplo n.º 4
0
 def test_list_volumes(self):
     RestHandler.login = mock.Mock(return_value=None)
     RestHandler.get_rest_info = mock.Mock(
         side_effect=[GET_ALL_POOLS, GET_ALL_LUNS])
     vol = DS8KDriver(**ACCESS_INFO).list_volumes(context)
     self.assertEqual(vol, volume_result)
Exemplo n.º 5
0
 def test_list_alerts(self, mock_alert):
     RestHandler.login = mock.Mock(return_value=None)
     mock_alert.return_value = GET_ALL_ALERTS
     alert = DS8KDriver(**ACCESS_INFO).list_alerts(context)
     alert[0]['occur_time'] = alert_result[0]['occur_time']
     self.assertEqual(alert, alert_result)
Exemplo n.º 6
0
 def test_list_storage_pools(self, mock_pool):
     RestHandler.login = mock.Mock(return_value=None)
     mock_pool.return_value = GET_ALL_POOLS
     pool = DS8KDriver(**ACCESS_INFO).list_storage_pools(context)
     self.assertEqual(pool, pool_result)
Exemplo n.º 7
0
 def test_get_storage(self, mock_storage):
     RestHandler.login = mock.Mock(return_value=None)
     mock_storage.return_value = GET_STORAGE
     storage = DS8KDriver(**ACCESS_INFO).get_storage(context)
     self.assertDictEqual(storage, storage_result)
Exemplo n.º 8
0
 def test_masking_views(self, mock_view):
     RestHandler.login = mock.Mock(return_value=None)
     mock_view.side_effect = [GET_ALL_HOSTS, GET_HOST_MAPPING]
     views = DS8KDriver(**ACCESS_INFO).list_masking_views(context)
     self.assertEqual(views, VIEW_RESULT)
Exemplo n.º 9
0
 def test_hosts(self, mock_host):
     RestHandler.login = mock.Mock(return_value=None)
     mock_host.return_value = GET_ALL_HOSTS
     hosts = DS8KDriver(**ACCESS_INFO).list_storage_hosts(context)
     self.assertEqual(hosts, HOST_RESULT)
Exemplo n.º 10
0
 def test_host_initiators(self, mock_init):
     RestHandler.login = mock.Mock(return_value=None)
     mock_init.return_value = GET_INITORATORS
     initiators = DS8KDriver(
         **ACCESS_INFO).list_storage_host_initiators(context)
     self.assertEqual(initiators, INIT_RESULT)