BF+TST: isStarted was not checking __asyncServer for exist before checking it

pull/1483/head
Yaroslav Halchenko 8 years ago
parent 52cd8a9a96
commit dfcf6f1963

@ -60,7 +60,7 @@ def _thread_name():
class Server:
def __init__(self, daemon = False):
def __init__(self, daemon=False):
self.__loggingLock = Lock()
self.__lock = RLock()
self.__jails = Jails()
@ -377,7 +377,7 @@ class Server:
return self.__jails[name].actions.getBanTime()
def isStarted(self):
self.__asyncServer.isActive()
return self.__asyncServer is not None and self.__asyncServer.isActive()
def isAlive(self, jailnum=None):
if jailnum is not None and len(self.__jails) != jailnum:

@ -158,6 +158,9 @@ class Transmitter(TransmitterBase):
def setUp(self):
self.server = TestServer()
super(Transmitter, self).setUp()
# so far isStarted only tested but not used otherwise
# and here we don't really .start server
self.assertFalse(self.server.isStarted())
def testStopServer(self):
self.assertEqual(self.transm.proceed(["stop"]), (0, None))
@ -1004,6 +1007,7 @@ class LoggingTests(LogCaptureTestCase):
server = TestServer()
try:
server.start(sock_name, pidfile_name, force=False)
self.assertFalse(server.isStarted())
self.assertLogged("Server already running")
finally:
server.quit()

Loading…
Cancel
Save