# 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 backups_api  # noqa: E501
from cohesivenet.rest import ApiException

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


class TestMSBackupsApi(object):
    """VNS3:ms Backups API unit tests"""

    def test_get_backups(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for get_backups
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/backups",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response={
                "response_type": "success",
                "response": {"backup_files": [], "failed_backups": []},
            },
        )(backups_api.get_backups)

    def test_delete_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for delete_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "DELETE",
            "/backups",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.delete_backup)

    def test_get_download_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for get_download_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/backups/download",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response="imafileimafileimafileimafileimafileimafileimafile",
        )(backups_api.get_download_backup)

    def test_post_upload_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for post_upload_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/backups/upload",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.post_upload_backup)

    def test_post_create_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for post_create_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/backups/create_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=BackupsApiData.CreateBackupResponse,
        )(backups_api.post_create_backup)

    def test_get_backup_job(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for get_backup_job
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/backups/create_backup/{uuid}",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response=BackupsApiData.BackupJobStatusResponse,
        )(backups_api.get_backup_job)

    def test_post_restore_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for post_restore_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/backups/restore_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.post_restore_backup)

    def test_get_snapshots_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for get_snapshots_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/snapshots_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response={
                "response_type": "success",
                "response": {
                    "snapshot_backup_file": {
                        "backup_name": "snapshots.tgz",
                        "create_time": "2020-01-01T10:10:10.000",
                        "size": 112312312,
                    }
                },
            },
        )(backups_api.get_snapshots_backup)

    def test_delete_snapshots_backup(self, rest_mocker, ms_client, ms_api_schema: dict):
        """Test case for delete_snapshots_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "DELETE",
            "/snapshots_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.delete_snapshots_backup)

    def test_get_download_snapshots_backup(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for get_download_snapshots_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/snapshots_backup/download",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response="imafileimafileimafileimafileimafileimafileimafile",
        )(backups_api.get_download_snapshots_backup)

    def test_post_upload_snapshots_backup(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for post_upload_snapshots_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/snapshots_backup/upload_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.post_upload_snapshots_backup)

    def test_get_snapshots_upload_status(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for get_snapshots_upload_status
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/snapshots_backup/upload_backup/{uuid}",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.get_snapshots_upload_status)

    def test_post_create_snapshots_backup(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for post_create_snapshots_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/snapshots_backup/create_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.post_create_snapshots_backup)

    def test_get_snapshots_backup_status(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for get_snapshots_backup_status
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "GET",
            "/snapshots_backup/create_backup/{uuid}",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.get_snapshots_backup_status)

    def test_post_restore_snapshots_backup(
        self, rest_mocker, ms_client, ms_api_schema: dict
    ):
        """Test case for post_restore_snapshots_backup
        """
        generate_method_test(
            ms_client,
            ms_api_schema,
            "POST",
            "/snapshots_backup/restore_backup",
            rest_mocker,
            mock_request_from_schema=True,
            mock_response_from_schema=True,
        )(backups_api.post_restore_snapshots_backup)
