~ubuntuone-control-tower/ubuntu-sso-client/trunk

« back to all changes in this revision

Viewing changes to ubuntu_sso/utils/webclient/tests/test_qtnetwork.py

  • Committer: Tarmac
  • Author(s): Rodney Dawes
  • Date: 2013-10-23 23:41:21 UTC
  • mfrom: (1034.1.1 ssl-force-load)
  • Revision ID: tarmac-20131023234121-gdep3a32krgbl4u2
Force loading of the system certificates in Qt, to avoid breaking certificate
checks on non-Ubuntu URLs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
# files in the program, then also delete it here.
29
29
"""Specific tests for the qt implementation."""
30
30
 
31
 
from PyQt4.QtNetwork import QSslError
 
31
from PyQt4.QtNetwork import (
 
32
    QSslConfiguration,
 
33
    QSslError,
 
34
)
32
35
from twisted.internet import defer
33
36
from ubuntuone.devtools.testcases import TestCase
34
37
 
139
142
        errors = [QSslError()]
140
143
        client._handle_ssl_errors(reply, errors)
141
144
        self.assertTrue(type(result[0]), unicode)
 
145
 
 
146
    def test_nonempty_cert_list(self):
 
147
        """Test the Qt CA list has more than our included certs."""
 
148
        qtnetwork.WebClient()
 
149
        ssl_config = QSslConfiguration.defaultConfiguration()
 
150
        ca_certs = ssl_config.caCertificates()
 
151
        self.assertTrue(len(ca_certs) > 3)