~tribaal/txaws/xss-hardening

« back to all changes in this revision

Viewing changes to txaws/client/tests/test_ssl.py

Merged 921421-completemultipart [r=oubiwann][f=921421]

This branch adds Complete Multipart method to s3 client.

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
        self.two_certs_dir = tempfile.mkdtemp()
170
170
        self.cert2 = self._write_pem(cert2, self.two_certs_dir, "cert2.pem")
171
171
        self.cert3 = self._write_pem(cert3, self.two_certs_dir, "cert3.pem")
172
 
        self.environment_copy = os.environ.copy()
173
172
 
174
173
    def tearDown(self):
175
174
        super(CertsFilesTestCase, self).tearDown()
179
178
        os.removedirs(self.no_certs_dir)
180
179
        os.removedirs(self.one_cert_dir)
181
180
        os.removedirs(self.two_certs_dir)
182
 
        os.environ.clear()
183
 
        os.environ.update(self.environment_copy)
184
181
 
185
182
    def _write_pem(self, cert, dir, filename):
186
183
        data = dump_certificate(FILETYPE_PEM, cert[1])
216
213
            self.no_certs_dir, self.one_cert_dir)
217
214
        certs = ssl.get_ca_certs()
218
215
        self.assertEqual(len(certs), 1)
219
 
 
220
 
    def test_get_ca_certs_no_current_dir(self):
221
 
        """
222
 
        Do not include the current directory if the TXAWS_CERTS_PATH
223
 
        environment variable ends with a ":".
224
 
        """
225
 
        self.addCleanup(os.chdir, os.getcwd())
226
 
        os.chdir(self.one_cert_dir)
227
 
        os.environ["TXAWS_CERTS_PATH"] = "%s:" % self.no_certs_dir
228
 
        self.assertRaises(exception.CertsNotFoundError, ssl.get_ca_certs)