<commit_before>﻿import unittest

from PySide.QtCore import *
from PySide.QtNetwork import *

from helper import UsesQApplication
from httpd import TestServer

class testAuthenticationSignal(UsesQApplication):

    def setUp(self):
        super(testAuthenticationSignal, self).setUp()
        self.httpd = TestServer(secure=True)
        self.httpd.start()
        self._resultOk = False

    def tearDown(self):
        self.httpd.shutdown()
        del self.httpd
        super(testAuthenticationSignal, self).tearDown()

    def onAuthRequest(self, hostname, port, auth):
        self.assert_(isinstance(auth, QAuthenticator))
        self._resultOk = True
        self.app.quit()


    def testwaitSignal(self):
        http = QHttp()
        http.setHost("localhost", self.httpd.port())
        http.connect(SIGNAL("authenticationRequired(const QString&, quint16, QAuthenticator*)"), self.onAuthRequest)
        path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/")
        data = http.get(path)
        self.app.exec_()
        self.assert_(self._resultOk)<commit_msg>Remove the dependecy of QtGui from a test located in QtNetwork.<commit_after>﻿import unittest

from PySide.QtCore import *
from PySide.QtNetwork import *

from helper import UsesQCoreApplication
from httpd import TestServer

class testAuthenticationSignal(UsesQCoreApplication):

    def setUp(self):
        super(testAuthenticationSignal, self).setUp()
        self.httpd = TestServer(secure=True)
        self.httpd.start()
        self._resultOk = False

    def tearDown(self):
        self.httpd.shutdown()
        del self.httpd
        super(testAuthenticationSignal, self).tearDown()

    def onAuthRequest(self, hostname, port, auth):
        self.assert_(isinstance(auth, QAuthenticator))
        self._resultOk = True
        self.app.quit()


    def testwaitSignal(self):
        http = QHttp()
        http.setHost("localhost", self.httpd.port())
        http.connect(SIGNAL("authenticationRequired(const QString&, quint16, QAuthenticator*)"), self.onAuthRequest)
        path = QUrl.toPercentEncoding("/index.html", "!$&'()*+,;=:@/")
        data = http.get(path)
        self.app.exec_()
        self.assert_(self._resultOk)
{'fraction_non_alphanumeric': 0.11825539568345324, 'fraction_numerical': 0.0017985611510791368, 'mean_word_length': 3.2140151515151514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6065789', 'n_tokens_mistral': 677, 'n_tokens_neox': 657, 'n_words': 131}