# Path: lighthouse/haproxy/stanzas/proxy.py
# class ProxyStanza(Stanza):
#     """
#     Stanza for independent proxy directives.
# 
#     These are used to add simple proxying to a system, e.g. communicating
#     with a third party service via a dedicated internal machine with a white-
#     listed IP.
#     """
# 
#     def __init__(self, name, port, upstreams, options=None, bind_address=None):
#         super(ProxyStanza, self).__init__("listen")
#         self.header = "listen " + name
# 
#         if not bind_address:
#             bind_address = ""
# 
#         self.add_line("bind %s:%s" % (bind_address, port))
# 
#         if options:
#             self.add_lines(options)
# 
#         for upstream in upstreams:
#             max_conn = ""
#             if "max_conn" in upstream:
#                 max_conn = "maxconn " + str(upstream["max_conn"])
# 
#             self.add_line(
#                 "server %(name)s %(name)s %(maxconn)s" % {
#                     "name": ":".join(
#                         [upstream["host"], str(upstream["port"])]
#                     ),
#                     "maxconn": max_conn
#                 }
#             )


    import unittest2 as unittest
    import unittest
from lighthouse.haproxy.stanzas.proxy import ProxyStanza
try:
except ImportError:



class ProxyStanzaTests(unittest.TestCase):

    def test_optional_bind_address(self):

# Path: lighthouse/haproxy/stanzas/proxy.py
# class ProxyStanza(Stanza):
#     """
#     Stanza for independent proxy directives.
# 
#     These are used to add simple proxying to a system, e.g. communicating
#     with a third party service via a dedicated internal machine with a white-
#     listed IP.
#     """
# 
#     def __init__(self, name, port, upstreams, options=None, bind_address=None):
#         super(ProxyStanza, self).__init__("listen")
#         self.header = "listen " + name
# 
#         if not bind_address:
#             bind_address = ""
# 
#         self.add_line("bind %s:%s" % (bind_address, port))
# 
#         if options:
#             self.add_lines(options)
# 
#         for upstream in upstreams:
#             max_conn = ""
#             if "max_conn" in upstream:
#                 max_conn = "maxconn " + str(upstream["max_conn"])
# 
#             self.add_line(
#                 "server %(name)s %(name)s %(maxconn)s" % {
#                     "name": ":".join(
#                         [upstream["host"], str(upstream["port"])]
#                     ),
#                     "maxconn": max_conn
#                 }
#             )


# Path: tests/haproxy/stanzas/proxy_tests.py
    import unittest2 as unittest
    import unittest
from lighthouse.haproxy.stanzas.proxy import ProxyStanza

try:
except ImportError:



class ProxyStanzaTests(unittest.TestCase):

    def test_optional_bind_address(self):

        stanza = ProxyStanza("payserver", 2222, [], bind_address="0.0.0.0")