summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-09-08 15:31:41 -0300
committerHugo Parente Lima <hugo.pl@gmail.com>2010-09-08 15:31:41 -0300
commite5348268a63a8fd15519c703c4e6e7feb34f4282 (patch)
tree559d52ecdbbd52348ea71341dc88b146898c7424
parent19f7b20dd0644e50762d6a571c9403a317028d06 (diff)
downloadshiboken-e5348268a63a8fd15519c703c4e6e7feb34f4282.tar.gz
shiboken-e5348268a63a8fd15519c703c4e6e7feb34f4282.tar.xz
shiboken-e5348268a63a8fd15519c703c4e6e7feb34f4282.zip
Make accessManager test do not depend on internet access.
-rw-r--r--tests/QtNetwork/accessManager_test.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/tests/QtNetwork/accessManager_test.py b/tests/QtNetwork/accessManager_test.py
index 9a00e7e7..172dab8c 100644
--- a/tests/QtNetwork/accessManager_test.py
+++ b/tests/QtNetwork/accessManager_test.py
@@ -6,18 +6,33 @@ import unittest
from PySide.QtCore import *
from PySide.QtNetwork import *
-from helper import UsesQApplication
+from helper import UsesQCoreApplication
+from httpd import TestServer
+
+class AccessManagerCase(UsesQCoreApplication):
+
+ def setUp(self):
+ super(AccessManagerCase, self).setUp()
+ self.httpd = TestServer()
+ self.httpd.start()
+ self.called = False
+
+ def tearDown(self):
+ super(AccessManagerCase, self).tearDown()
+ self.httpd.shutdown()
-class AccessManagerCase(UsesQApplication):
def slot_replyFinished(self, reply):
self.assertEqual(type(reply), QNetworkReply)
+ self.called = True
self.app.quit()
def testNetworkRequest(self):
manager = QNetworkAccessManager()
manager.finished.connect(self.slot_replyFinished)
- manager.get(QNetworkRequest(QUrl("http://qt.nokia.com")))
+ manager.get(QNetworkRequest(QUrl("http://localhost:%s" % self.httpd.port())))
self.app.exec_()
+ self.assert_(self.called)
+ self.httpd.shutdown()
if __name__ == '__main__':
unittest.main()