def test_auth_with_good_assertion(self):
     plugin = BrowserIDPlugin(["localhost"], verifier=DummyVerifierValid())
     environ = make_environ()
     assertion = make_fake_assertion("*****@*****.**")
     identity = {"browserid.assertion": assertion}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, "*****@*****.**")
 def test_auth_with_good_assertion(self):
     plugin = BrowserIDPlugin(["localhost"], verifier=DummyVerifierValid())
     environ = make_environ()
     assertion = make_fake_assertion("*****@*****.**")
     identity = {"browserid.assertion": assertion}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, "*****@*****.**")
 def test_auth_with_malformed_assertion(self):
     plugin = BrowserIDPlugin(["localhost"], verifier=DummyVerifierValid())
     environ = make_environ()
     identity = {"browserid.assertion": "JUNK"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "Malformed BrowserID assertion")
 def test_auth_with_no_assertion(self):
     plugin = BrowserIDPlugin(None, verifier=DummyVerifierValid())
     environ = make_environ()
     identity = {"some other thing": "not browserid"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "No BrowserID assertion found")
 def test_auth_with_malformed_assertion(self):
     plugin = BrowserIDPlugin(["localhost"], verifier=DummyVerifierValid())
     environ = make_environ()
     identity = {"browserid.assertion": "JUNK"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "Malformed BrowserID assertion")
 def test_auth_with_no_assertion(self):
     plugin = BrowserIDPlugin(None, verifier=DummyVerifierValid())
     environ = make_environ()
     identity = {"some other thing": "not browserid"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "No BrowserID assertion found")
 def test_auth_with_unrecognised_audience(self):
     plugin = BrowserIDPlugin(["GOOD"], verifier=DummyVerifierValid())
     environ = make_environ(HTTP_HOST="BAD")
     assertion = make_fake_assertion("*****@*****.**", "BAD")
     identity = {"browserid.assertion": assertion}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "Invalid BrowserID assertion")
 def test_auth_with_unrecognised_audience(self):
     plugin = BrowserIDPlugin(["GOOD"], verifier=DummyVerifierValid())
     environ = make_environ(HTTP_HOST="BAD")
     assertion = make_fake_assertion("*****@*****.**", "BAD")
     identity = {"browserid.assertion": assertion}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "Invalid BrowserID assertion")
 def test_auth_with_invalid_assertion(self):
     plugin = BrowserIDPlugin(["localhost"],
                              verifier=DummyVerifierInvalid())
     environ = make_environ()
     assertion = make_fake_assertion("*****@*****.**")
     identity = {"browserid.assertion": assertion}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "Invalid BrowserID assertion")
 def test_auth_with_invalid_assertion(self):
     plugin = BrowserIDPlugin(["localhost"],
                              verifier=DummyVerifierInvalid())
     environ = make_environ()
     assertion = make_fake_assertion("*****@*****.**")
     identity = {"browserid.assertion": assertion}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
     self.assertEquals(environ[_ENVKEY_ERROR_MESSAGE],
                       "Invalid BrowserID assertion")
 def test_auth_with_bad_assertion(self):
     plugin = BrowserIDPlugin(urlopen=urlopen_invalid)
     environ = make_environ(HTTP_HOST="localhost")
     identity = {"browserid.assertion": "*****@*****.**"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
 def test_auth_with_no_audience(self):
     plugin = BrowserIDPlugin(urlopen=urlopen_valid)
     environ = make_environ()
     identity = {"browserid.assertion": "*****@*****.**"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)
 def test_auth_with_no_assertion(self):
     plugin = BrowserIDPlugin(urlopen=urlopen_valid)
     environ = make_environ(HTTP_HOST="localhost")
     identity = {"some other thing": "not browserid"}
     userid = plugin.authenticate(environ, identity)
     self.assertEquals(userid, None)