# -*- coding: utf-8 -*-

"""
    apimatic_calculator

    This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""

import jsonpickle
import dateutil.parser
from .controller_test_base import ControllerTestBase
from ..test_helper import TestHelper
from apimatic_calculator.api_helper import APIHelper


class SimpleCalculatorControllerTests(ControllerTestBase):

    @classmethod
    def setUpClass(cls):
        super(SimpleCalculatorControllerTests, cls).setUpClass()
        cls.controller = cls.api_client.simple_calculator

    # Checks if the test case returns the correct value after adding the input variables.
    def test_test_sum(self):
        # Parameters for the API call
        operation = 'SUM'
        x = 20
        y = 30

        # Perform the API call through the SDK function
        result = self.controller.get_calculate(operation, x, y)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)
        
        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        self.assertEqual('50', self.response_catcher.response.raw_body)


    # Checks if the test case returns the correct value after subtracting the input variables.
    def test_test_subtract(self):
        # Parameters for the API call
        operation = 'SUBTRACT'
        x = 30
        y = 20

        # Perform the API call through the SDK function
        result = self.controller.get_calculate(operation, x, y)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)
        
        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        self.assertEqual('10', self.response_catcher.response.raw_body)


    # Checks if the test case returns the correct value after multiplying the input variables.
    def test_test_multiply(self):
        # Parameters for the API call
        operation = 'MULTIPLY'
        x = 20
        y = 3.5

        # Perform the API call through the SDK function
        result = self.controller.get_calculate(operation, x, y)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)
        
        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        self.assertEqual('70', self.response_catcher.response.raw_body)


    # Checks if the test case returns the correct value after dividing the input variables.
    def test_test_divide(self):
        # Parameters for the API call
        operation = 'DIVIDE'
        x = 30
        y = 2

        # Perform the API call through the SDK function
        result = self.controller.get_calculate(operation, x, y)

        # Test response code
        self.assertEquals(self.response_catcher.response.status_code, 200)
        
        # Test whether the captured response is as we expected
        self.assertIsNotNone(result)
        self.assertEqual('15', self.response_catcher.response.raw_body)


