Esempio n. 1
0
 def test_add_host_to_hostset_hostset_create_sucess_login(self, mock_client):
     """
     hpe3par hostset - create a hostset
     """
     result = hostset.add_hosts(
         mock_client, "user", "pass", "host", ["members"])
     self.assertEqual(result, (True, True, 'Added hosts successfully.', {}))
Esempio n. 2
0
 def test_add_host_to_hostset_No_new_members_to_add_to_the_Host_set_login_setmembers_none(self, mock_client):
     """
     hpe3par flash cache - create a flash cache
     """
     mock_client.HPE3ParClient.getHostSet.return_value.setmembers = None
     result = hostset.add_hosts(
         mock_client.HPE3ParClient, "user", "password", "hostname", ["member1"])
     self.assertEqual(result, (True, True, 'Added hosts successfully.', {}))
Esempio n. 3
0
 def test_add_host_to_hostset_hostset_doesnt_exists(self, mock_client):
     """
     hpe3par flash cache - create a flash cache
     """
     mock_client.HPE3ParClient.hostSetExists.return_value = False
     result = hostset.add_hosts(
         mock_client.HPE3ParClient, "user", "password", "hostname", ["member1"])
     self.assertEqual(result, (False, False, "Hostset does not exist", {}))
Esempio n. 4
0
 def test_add_host_to_hostset_No_new_members_to_add_to_the_Host_set(self, mock_client):
     """
     hpe3par flash cache - create a flash cache
     """
     mock_client.HPE3ParClient.getHostSet.return_value.setmembers = [
         "member1"]
     result = hostset.add_hosts(
         mock_client.HPE3ParClient, "user", "password", "hostname", ["member1"])
     self.assertEqual(
         result, (True, False, "No new members to add to the Host set hostname. Nothing to do.", {}))
Esempio n. 5
0
 def test_add_host_to_hostset_hostset_create_exception_in_login(self, mock_client):
     """
     hpe3par hostset - create a hostset
     """
     mock_client.HPE3ParClient.login.side_effect = Exception(
         "Failed to login!")
     result = hostset.add_hosts(
         mock_client.HPE3ParClient, "user", "password", "host", ["members"])
     self.assertEqual(
         result, (False, False, "Add hosts to hostset failed | Failed to login!", {}))
Esempio n. 6
0
    def test_add_host_to_hostset_hostset_hostname_empty(self, mock_client):
        """
        hpe3par hostset - create a hostset
        """
        result = hostset.add_hosts(mock_client, "user", "pass", None, None)

        self.assertEqual(result, (
            False,
            False,
            "Add host to hostset failed. Hostset name is null",
            {}))
Esempio n. 7
0
    def test_add_host_to_hostset_hostset_username_empty(self, mock_client):
        """
        hpe3par hostset - create a hostset
        """
        result = hostset.add_hosts(mock_client, None, None, None, None)

        self.assertEqual(result, (
            False,
            False,
            "Add host to hostset failed. Storage system username or password is null",
            {}))
Esempio n. 8
0
    def test_add_host_to_hostset_hostset_setmembers_empty(self, mock_client):
        """
        hpe3par hostset - create a hostset
        """
        result = hostset.add_hosts(
            mock_client, "user", "pass", "hostset", None)

        self.assertEqual(result, (
            False,
            False,
            "setmembers delete failed. Setmembers is null",
            {}))