Beispiel #1
0
    def test_add_initiator_chap_chapsecret_empty(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_initiator_chap(mock_client, "user", "pass", "host",
                                         "chap", None, None)

        self.assertEqual(result,
                         (False, False,
                          "Host modification failed. chap_secret is null", {}))
Beispiel #2
0
    def test_add_initiator_chap_success(self, mock_HPE3ParClient, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        mock_HPE3ParClient.CHAP_INITIATOR = 1
        result = host.add_initiator_chap(mock_client.HPE3ParClient, "user",
                                         "pass", "host", "chap",
                                         "secretsecretsecretsecretsecret12",
                                         True)

        self.assertEqual(result, (True, True, "Added initiator chap.", {}))
Beispiel #3
0
    def test_add_initiator_chap_chaphex_false(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_initiator_chap(mock_client, "user", "pass", "host",
                                         "chap", "secret", False)

        self.assertEqual(result, (
            False, False,
            "Add initiator chap failed. Chap secret hex is false and chap secret less than 12 characters or more than 16 characters",
            {}))
Beispiel #4
0
    def test_add_initiator_chap_username_empty(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_initiator_chap(mock_client, None, None, None, None,
                                         None, None)

        self.assertEqual(result, (
            False, False,
            "Host modification failed. Storage system username or password is null",
            {}))
Beispiel #5
0
    def test_add_initiator_chap_exception(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        mock_client.login.side_effect = Exception("Failed to login!")
        mock_client.return_value = mock_client
        result = host.add_initiator_chap(mock_client, "user", "pass", "host",
                                         "chap",
                                         "secretsecretsecretsecretsecret12",
                                         True)

        self.assertEqual(
            result,
            (False, False, "Add initiator chap failed | Failed to login!", {}))