import sys
import unittest
import urllib2

try:
    from StringIO import StringIO
except ImportError:
    from io import StringIO

try:
    from mock import patch, Mock, call
except ImportError:
    from unittest.mock import patch, Mock, call

from gordon.contrib.utils import gordon_sleep


class TestGordonContribUtils(unittest.TestCase):

    def _event(self):
        return {
            'StackId': 'stack_id',
            'RequestId': 'request_id',
            'LogicalResourceId': 'logical_resource_id',
            'ResponseURL': 'http://localhost/response'
        }

    def _context(self):
        return {
            'logStreamName': 'log_stream_name'
        }

    @patch('urllib2.OpenerDirector.open')
    def test_cfn_send_success(self, open_mock):
        open_mock.return_value = Mock()
        open_mock.return_value.msg = 'OK'
        open_mock.return_value.getcode.return_value = 200
        response = gordon_sleep.send(
            event=self._event(),
            context=self._context(),
            responseStatus='response_status',
            responseData='response_data',
        )
        self.assertTrue(response)

    @patch('urllib2.OpenerDirector.open')
    def test_cfn_send_error(self, open_mock):

        class MockHTTPError(urllib2.HTTPError):
            def __init__(self, code=503):
                self.code = code

        open_mock.side_effect = MockHTTPError
        response = gordon_sleep.send(
            event=self._event(),
            context=self._context(),
            responseStatus='response_status',
            responseData='response_data',
        )
        self.assertFalse(response)

@@ -241,55 +241,8 @@
 ll%0A%0A
-from gordon.contrib.utils import gordon_sleep%0A%0A
 %0Acla
@@ -258,20 +258,8 @@
 rdon
-ContribUtils
 (uni
@@ -288,1301 +288,31 @@
 def 
-_event(self):%0A        return %7B%0A            'StackId': 'stack_id',%0A            'RequestId': 'request_id',%0A            'LogicalResourceId': 'logical_resource_id',%0A            'ResponseURL': 'http://localhost/response'%0A        %7D%0A%0A    def _context(self):%0A        return %7B%0A            'logStreamName': 'log_stream_name'%0A        %7D%0A%0A    @patch('urllib2.OpenerDirector.open')%0A    def test_cfn_send_success(self, open_mock):%0A        open_mock.return_value = Mock()%0A        open_mock.return_value.msg = 'OK'%0A        open_mock.return_value.getcode.return_value = 200%0A        response = gordon_sleep.send(%0A            event=self._event(),%0A            context=self._context(),%0A            responseStatus='response_status',%0A            responseData='response_data',%0A        )%0A        self.assertTrue(response)%0A%0A    @patch('urllib2.OpenerDirector.open')%0A    def test_cfn_send_error(self, open_mock):%0A%0A        class MockHTTPError(urllib2.HTTPError):%0A            def __init__(self, code=503):%0A                self.code = code%0A%0A        open_mock.side_effect = MockHTTPError%0A        response = gordon_sleep.send(%0A            event=self._event(),%0A            context=self._context(),%0A            responseStatus='response_status',%0A            responseData='response_data',%0A        )%0A        self.assertFalse(response)
+test(self):%0A        return
 %0A

Remove tests