def test_create_flash_cache_create_already_present(self, mock_client):
     """
     hpe3par flash cache - create a flash cache
     """
     result = flash_cache.create_flash_cache(mock_client, "user",
                                             "password", 1024, None)
     self.assertEqual(result,
                      (True, False, "Flash Cache already present", {}))
 def test_create_flash_cache_create_sucess_login(self, mock_client):
     """
     hpe3par flash cache - create a flash cache
     """
     mock_client.HPE3ParClient.flashCacheExists.return_value = False
     result = flash_cache.create_flash_cache(mock_client.HPE3ParClient,
                                             "user", "password", 1024, None)
     self.assertEqual(result,
                      (True, True, "Created Flash Cache successfully.", {}))
    def test_create_flash_cache_size_in_gib_empty(self, mock_client):
        """
        hpe3par flash cache - create a flash cache
        """
        result = flash_cache.create_flash_cache(mock_client, "user",
                                                "password", None, None)

        self.assertEqual(
            result,
            (False, False, "Flash Cache creation failed. Size is null", {}))
 def test_create_flash_cache_create_exception_in_login(self, mock_client):
     """
     hpe3par flash cache - create a flash cache
     """
     mock_client.HPE3ParClient.login.side_effect = Exception(
         "Failed to login!")
     result = flash_cache.create_flash_cache(mock_client.HPE3ParClient,
                                             "user", "password", 1024, None)
     self.assertEqual(
         result, (False, False,
                  "Flash Cache creation failed | Failed to login!", {}))
    def test_create_flash_cache_username_empty(self, mock_client):
        """
        hpe3par flash cache - create a flash cache
        """
        result = flash_cache.create_flash_cache(mock_client, None, None, None,
                                                None)

        self.assertEqual(result, (
            False, False,
            "Flash Cache creation failed. Storage system username or password is null",
            {}))