コード例 #1
0
class TestListEnvsHandler(TestCase):
    def setUp(self):
        """
        Create an instance each time for testing.
        """
        self.instance = ListEnvsHandler()

    def test_call(self):
        """
        Verify running ListEnvsHandler returns proper information.
        """
        environ = {}
        buffer = {}

        def start_response(code, headers):
            buffer['code'] = code
            buffer['headers'] = headers

        result = self.instance.__call__(environ, start_response)
        assert buffer['code'] == '200 OK'
        assert buffer['headers'] == [("Content-Type", "application/json")]
        assert type(result) == str

        results = json.loads(result)
        assert results == self.instance._conf['hosts'].values()
コード例 #2
0
class TestListEnvsHandler(TestCase):

    def setUp(self):
        """
        Create an instance each time for testing.
        """
        self.instance = ListEnvsHandler()

    def test_call(self):
        """
        Verify running ListEnvsHandler returns proper information.
        """
        environ = {}
        buffer = {}

        def start_response(code, headers):
            buffer['code'] = code
            buffer['headers'] = headers

        result = self.instance.__call__(environ, start_response)
        assert buffer['code'] == '200 OK'
        assert buffer['headers'] == [("Content-Type", "application/json")]
        assert type(result) == str

        results = json.loads(result)
        assert results == self.instance._conf['hosts'].values()
コード例 #3
0
 def setUp(self):
     """
     Create an instance each time for testing.
     """
     self.instance = ListEnvsHandler()
コード例 #4
0
 def setUp(self):
     """
     Create an instance each time for testing.
     """
     self.instance = ListEnvsHandler()