# Path: payway/merchants/http.py
# class MerchantHttpClient(HttpClient):
# 
#     @classmethod
#     def notify(cls, merchant, order):
#         result = ''
#         try:
#             request = MerchantHttpRequest(merchant, order)
#             response = cls.execute(request)
#             result = response.text
#         except ConnectionError:
#             logging.warn('Problems when connecting to merchant {0}'.format(merchant.result_url))
#         return result
# 
# RESPONSE_STATUS = Choices(
#     ('OK', 'OK'),
# )


from mock import Mock
from requests.exceptions import ConnectionError
from simptools.wrappers.http import HttpClient
from payway.merchants.http import MerchantHttpClient, RESPONSE_STATUS
# -*- coding: UTF-8 -*-

__author__ = 'Razzhivin Alexander'
__email__ = 'admin@httpbots.com'


def mock_MerchantHttpClient_success_execute():

    class ResponseMock(object):
        text = RESPONSE_STATUS.OK
    MerchantHttpClient.execute = Mock(return_value=ResponseMock())

def mock_MerchantHttpClient_fail_execute():
    mock = Mock()
    mock.side_effect = ConnectionError()
    MerchantHttpClient.execute = mock

def set_back_MerchantHttpClient_execute():

# Path: payway/merchants/http.py
# class MerchantHttpClient(HttpClient):
# 
#     @classmethod
#     def notify(cls, merchant, order):
#         result = ''
#         try:
#             request = MerchantHttpRequest(merchant, order)
#             response = cls.execute(request)
#             result = response.text
#         except ConnectionError:
#             logging.warn('Problems when connecting to merchant {0}'.format(merchant.result_url))
#         return result
# 
# RESPONSE_STATUS = Choices(
#     ('OK', 'OK'),
# )


# Path: payway/orders/tests/mocks.py
from mock import Mock
from requests.exceptions import ConnectionError
from simptools.wrappers.http import HttpClient
from payway.merchants.http import MerchantHttpClient, RESPONSE_STATUS

# -*- coding: UTF-8 -*-

__author__ = 'Razzhivin Alexander'
__email__ = 'admin@httpbots.com'


def mock_MerchantHttpClient_success_execute():

    class ResponseMock(object):
        text = RESPONSE_STATUS.OK
    MerchantHttpClient.execute = Mock(return_value=ResponseMock())

def mock_MerchantHttpClient_fail_execute():
    mock = Mock()
    mock.side_effect = ConnectionError()
    MerchantHttpClient.execute = mock

def set_back_MerchantHttpClient_execute():

    MerchantHttpClient.execute = HttpClient.execute