Fixed QtNetwork test to use '127.0.0.1' instead of 'localhost'
This is necessary to make all test to be able run on any buildbot machine. Fix Http server shutdown sequence to avoid deadlocks. Fixes bug #587 Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org> Marcelo Lira <marcelo.lira@openbossa.org>
This commit is contained in:
parent
6383832408
commit
53e649629b
3 changed files with 29 additions and 14 deletions
|
|
@ -15,19 +15,23 @@ class testAuthenticationSignal(UsesQCoreApplication):
|
|||
self._resultOk = False
|
||||
|
||||
def tearDown(self):
|
||||
self.httpd.shutdown()
|
||||
del self.httpd
|
||||
if self.httpd:
|
||||
self.httpd.shutdown()
|
||||
del self.httpd
|
||||
super(testAuthenticationSignal, self).tearDown()
|
||||
|
||||
def goAway(self):
|
||||
self.httpd.shutdown()
|
||||
self.app.quit()
|
||||
self.httpd = None
|
||||
|
||||
def onAuthRequest(self, hostname, port, auth):
|
||||
self.assert_(isinstance(auth, QAuthenticator))
|
||||
self._resultOk = True
|
||||
self.app.quit()
|
||||
|
||||
self.goAway()
|
||||
|
||||
def testwaitSignal(self):
|
||||
http = QHttp()
|
||||
http.setHost("localhost", self.httpd.port())
|
||||
http = QHttp('127.0.0.1', self.httpd.port())
|
||||
http.connect(SIGNAL("authenticationRequired(const QString&, quint16, QAuthenticator*)"), self.onAuthRequest)
|
||||
path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/")
|
||||
data = http.get(str(path))
|
||||
|
|
@ -35,8 +39,7 @@ class testAuthenticationSignal(UsesQCoreApplication):
|
|||
self.assert_(self._resultOk)
|
||||
|
||||
def testwaitSignal2(self):
|
||||
http = QHttp()
|
||||
http.setHost("localhost", self.httpd.port())
|
||||
http = QHttp('127.0.0.1', self.httpd.port())
|
||||
# Using new signal slot syntax causes a segfault
|
||||
http.authenticationRequired.connect(self.onAuthRequest)
|
||||
path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue