mozilla/PyBrowserID — pull request #1 by Osmose (2012-04-03 20:17:42+00:00)
Title: Switch to Requests

Replaces secure_urlopen with code that uses the requests library. Requests comes pre-packaged with certs derived from the Firefox cert pack, which will successfully validate browserid.org HTTPS without the need for the user to get the right certs. Also, the Requests API is just better. :D

I also modified most of the tests to use the mock library for mocking out Requests. I moved some tests around as well (remote verifier tests were testing the fetch_public_key method, which isn't very good isolation).

Note that this pull request is incomplete; one test is failing. It's a test for the local verifier. I modified the test to avoid making an external request during the test run and included a copy of browserid.org's most recent JWT. This should make the test work from what I can gather from the old code, but it fails:

```
======================================================================
ERROR: test_well_known_doc_with_public_key (browserid.tests.test_verifiers.TestLocalVerifier)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/mkelly/Projects/PyBrowserID/browserid/tests/test_verifiers.py", line 136, in test_well_known_doc_with_public_key
self.assertTrue(self.verifier.verify(assertion))
File "/Users/mkelly/Projects/PyBrowserID/browserid/verifiers/local.py", line 94, in verify
cert = self.verify_certificate_chain(certificates, now=now)
File "/Users/mkelly/Projects/PyBrowserID/browserid/verifiers/local.py", line 133, in verify_certificate_chain
raise InvalidSignatureError("bad signature in chain")
InvalidSignatureError: bad signature in chain
```