Пример #1
0
    def test_add_target_chap_success(self, mock_HPE3ParClient, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        mock_HPE3ParClient.CHAP_TARGET = 1
        result = host.add_target_chap(mock_client, "user", "pass", "host",
                                      "chap",
                                      "secretsecretsecretsecretsecret12", True)

        self.assertEqual(result, (True, True, "Added target chap.", {}))
Пример #2
0
    def test_add_target_chap_chapsecret_empty(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_target_chap(mock_client, "user", "pass", "host",
                                      "chap", None, None)

        self.assertEqual(result,
                         (False, False,
                          "Host modification failed. chap_secret is null", {}))
Пример #3
0
    def test_add_target_chap_chaphex_false(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_target_chap(mock_client, "user", "pass", "host",
                                      "chap", "secret", False)

        self.assertEqual(result, (
            False, False,
            "Attribute chap_secret must be 12 to 16 character if chap_secret_hex is false",
            {}))
Пример #4
0
    def test_add_target_chap_chaphex_true(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_target_chap(mock_client, "user", "pass", "host",
                                      "chap", "secret", True)

        self.assertEqual(result, (
            False, False,
            "Attribute chap_secret must be 32 hexadecimal characters if chap_secret_hex is true",
            {}))
Пример #5
0
    def test_add_target_chap_username_empty(self, mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        result = host.add_target_chap(mock_client, None, None, None, None,
                                      None, None)

        self.assertEqual(result, (
            False, False,
            "Host modification failed. Storage system username or password is null",
            {}))
Пример #6
0
    def test_add_target_chap_exists(self, mock_initiator_chap_exists,
                                    mock_client):
        """
        hpe3par host - add_initiator_chap
        """
        mock_initiator_chap_exists.return_value = False
        result = host.add_target_chap(mock_client.HPE3ParClient, "user",
                                      "pass", "host", "chap",
                                      "secretsecretsecretsecretsecret12", True)

        self.assertEqual(result,
                         (True, False, "Initiator chap does not exist", {}))
Пример #7
0
    def test_add_target_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_target_chap(mock_client, "user", "pass", "host",
                                      "chap",
                                      "secretsecretsecretsecretsecret12", True)

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