# coding: utf-8

"""
    VNS3:ms API

    Cohesive networks VNS3 API providing complete control of your network's addresses, routes, rules and edge  # noqa: E501

    Contact: solutions@cohesive.net
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import pytest

import cohesivenet
from cohesivenet.api.vns3ms import access_api  # noqa: E501
from cohesivenet.rest import ApiException

from tests.openapi import generate_method_test
from tests.vns3ms.stub_data import AccessApiData


class TestMSAccessApi(object):
    """AccessApi unit tests"""

    def test_put_activate_api_key(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for put_activate_api_key
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "PUT",
            "/auth/activate",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(access_api.put_activate_api_key)

    def test_post_create_token(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for post_create_token
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/auth",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=AccessApiData.TokenResponse,
        )(access_api.post_create_token)

    def test_put_expire_token(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for put_expire_token
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "PUT",
            "/auth/expire_token",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=AccessApiData.ExpireTokenResponse,
        )(access_api.put_expire_token)

    def test_put_invalidate_api_key_tokens(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for put_invalidate_api_key_tokens
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "PUT",
            "/auth/invalidate_tokens",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=AccessApiData.ExpireKeyTokens,
        )(access_api.put_invalidate_api_key_tokens)

    def test_get_api_keys(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for get_api_keys
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/auth/api_keys",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=AccessApiData.ApiKeysResponse,
        )(access_api.get_api_keys)

    def test_post_create_api_key(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for post_create_api_key
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/auth/api_key",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=AccessApiData.NewApiKeyResponse,
        )(access_api.post_create_api_key)

    def test_put_update_api_key(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for put_update_api_key
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "PUT",
            "/auth/api_key/{key_id}",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=AccessApiData.ApiKeyUpdatedResponse,
        )(access_api.put_update_api_key)

    def test_delete_api_key(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for delete_api_key
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "DELETE",
            "/auth/api_key/{key_id}",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response={"response_type": "success", "response": "Deleted key"},
        )(access_api.delete_api_key)
