# coding: utf-8

"""
    Web API Swagger specification

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

    OpenAPI spec version: 1.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import os
import sys
import unittest

ABSPATH = os.path.abspath(os.path.realpath(os.path.dirname(__file__)) + "/..")
sys.path.append(ABSPATH)
import asposeDiagramcloud
import test_base

from asposeDiagramcloud.rest import ApiException
from asposeDiagramcloud.apis.diagram_file_api import DiagramFileApi
from asposeDiagramcloud.models import FileFormatRequest

class TestDiagramFileApi(unittest.TestCase):
    """ DiagramFileApi unit test stubs """

    def setUp(self):
        self.api_client = test_base.GetApiClient()
        self.api = asposeDiagramcloud.apis.diagram_file_api.DiagramFileApi(self.api_client)

    def tearDown(self):
        pass

    def test_diagram_file_get_diagram(self):
        """
        Test case for diagram_file_get_diagram

        Read document info or export.
        """
        name ='file_get_1.vdx'       
        folder = "Temp"
        result = self.api.diagram_file_get_diagram(name,format="pdf",folder=folder)
        print(result);
        self.assertIsNotNone(result, 'Error has occurred while get file')

    def test_diagram_file_post_save_as(self):
        """
        Test case for diagram_file_post_save_as

        Convert document and save result to storage.
        """
        name ='file_get_1.vdx'       
        folder = "Temp"
        is_overwrite = "true"
        format =FileFormatRequest(format="pdf")
        newfilename = "file_saveas_python.pdf"
        result = self.api.diagram_file_post_save_as(name,folder=folder,newfilename=newfilename,format=format,is_overwrite=is_overwrite)
        self.assertTrue(result.code == 200, 'Error has occurred while save as file')

    def test_diagram_file_put_create(self):
        """
        Test case for diagram_file_put_create

        Create new diagram and save result to storage.
        """
        name ='file_create_python.vdx'       
        folder = "Temp"
        is_overwrite = "true"
        result = self.api.diagram_file_put_create(name,folder=folder,is_overwrite=is_overwrite)
        self.assertTrue(result.code == 200, 'Error has occurred while create file')

    def test_upload_file_with_storage_api(self):
        """
        Test case for test_upload_file_with_storage_api

        Upload file and save result to storage.
        """
        name ='file_upload_python.vdx'       
        folder = "Temp"
        local_file_path = os.path.dirname(os.path.realpath(__file__)) + "/../testData/file_upload.vdx"
        result=test_base.Upload(local_file_path,name,folder)
        self.assertTrue(result == True, 'Error has occurred while upload file')

if __name__ == '__main__':
    unittest.main()
