def test_remove_host_from_volumeset_volumeset_doesnt_exists(self, mock_client):
     """
     hpe3par volumeset - remove volume from a volumeset
     """
     mock_client.HPE3ParClient.volumeSetExists.return_value = False
     mock_client.HPE3ParClient.return_value = mock_client
     result = volumeset.remove_volumes(
         mock_client.HPE3ParClient, "user", "password", "hostname", ["member1"])
     self.assertEqual(result, (True, False, "Volumeset does not exist", {}))
 def test_remove_host_from_volumeset_No_new_members_to_remove_from_the_Host_set_setmembers_none(self, mock_client):
     """
     hpe3par volumeset - remove volume from a volumeset
     """
     mock_client.HPE3ParClient.getVolumeSet.return_value.setmembers = None
     mock_client.HPE3ParClient.return_value = mock_client
     result = volumeset.remove_volumes(
         mock_client.HPE3ParClient, "user", "password", "hostname", ["member1"])
     self.assertEqual(
         result, (True, True, 'Removed volumes successfully.', {}))
 def test_remove_host_from_volumeset_No_new_members_to_remove_from_the_Host_set(self, mock_client):
     """
     hpe3par volumeset - remove volume from a volumeset
     """
     mock_client.HPE3ParClient.getVolumeSet.return_value.setmembers = []
     mock_client.HPE3ParClient.return_value = mock_client
     result = volumeset.remove_volumes(
         mock_client.HPE3ParClient, "user", "password", "hostname", ["member1"])
     self.assertEqual(
         result, (True, False, "No members to remove to the Volume set hostname. Nothing to do.", {}))
 def test_remove_host_from_volumeset_volumeset_create_exception_in_login(self, mock_client):
     """
     hpe3par volumeset - remove volume from a volumeset
     """
     mock_client.HPE3ParClient.login.side_effect = Exception(
         "Failed to login!")
     mock_client.HPE3ParClient.return_value = mock_client
     result = volumeset.remove_volumes(
         mock_client.HPE3ParClient, "user", "password", "host", ["members"])
     self.assertEqual(
         result, (False, False, "Remove volumes from volumeset failed | Failed to login!", {}))
 def test_remove_host_from_volumeset_volumeset_create_sucess_login(self, mock_client):
     """
     hpe3par volumeset - remove volume from a volumeset
     """
     mock_client.volumesetExists.return_value = True
     mock_client.getVolumeSet.return_value.setmembers = ["members"]
     mock_client.return_value = mock_client
     result = volumeset.remove_volumes(
         mock_client, "user", "pass", "host", ["members"])
     self.assertEqual(
         result, (True, True, 'Removed volumes successfully.', {}))
    def test_remove_host_from_volumeset_volumeset_username_empty(self, mock_client):
        """
        hpe3par volumeset - remove volume from a volumeset
        """
        result = volumeset.remove_volumes(mock_client, None, None, None, None)

        self.assertEqual(result, (
            False,
            False,
            "Remove volume(s) from Volumeset failed. Storage system username or password is null",
            {}))
    def test_remove_host_from_volumeset_volumeset_setmembers_empty(self, mock_client):
        """
        hpe3par volumeset - remove volume from a volumeset
        """
        result = volumeset.remove_volumes(
            mock_client, "user", "pass", "volumeset", None)

        self.assertEqual(result, (
            False,
            False,
            "Remove volume(s) from Volumeset failed. Setmembers is null",
            {}))