def test_HAProxyStatusView_status_code_is_configurable(self): config.push('change_haproxy_status_code', dedent(''' [haproxy_status_view] going_down_status: 499 ''')) self.addCleanup(config.pop, 'change_haproxy_status_code') haproxy.set_going_down_flag(True) result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False) self.assertEquals(499, result.getStatus())
def test_HAProxyStatusView_status_code_is_configurable(self): config.push( 'change_haproxy_status_code', dedent(''' [haproxy_status_view] going_down_status: 499 ''')) self.addCleanup(config.pop, 'change_haproxy_status_code') haproxy.set_going_down_flag(True) result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False) self.assertEqual(499, result.getStatus())
def test_switch_going_down_flag(self): haproxy.set_going_down_flag(True) haproxy.switch_going_down_flag() self.assertEqual(False, haproxy.going_down_flag) haproxy.switch_going_down_flag() self.assertEqual(True, haproxy.going_down_flag)
def test_HAProxyStatusView_going_down_returns_500(self): haproxy.set_going_down_flag(True) result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False) self.assertEqual(500, result.getStatus())
def test_switch_going_down_flag(self): haproxy.set_going_down_flag(True) haproxy.switch_going_down_flag() self.assertEquals(False, haproxy.going_down_flag) haproxy.switch_going_down_flag() self.assertEquals(True, haproxy.going_down_flag)
def test_HAProxyStatusView_going_down_returns_500(self): haproxy.set_going_down_flag(True) result = self.http(u'GET /+haproxy HTTP/1.0', handle_errors=False) self.assertEquals(500, result.getStatus())