def test_possible_erroneous_credentials(self): "Test that we don't stray from our self-calculated output" # Same as above test, but with a different signature ms = Signature(self.rfc_credentials, host="example.com", port=80, method="GET") ms.sign_request(uri="/resource/1?b=1&a=2", timestamp="1336363200", nonce="dj83hs9s") example_bs = "1336363200\ndj83hs9s\nGET\n/resource/1?b=1&a=2\nexample.com\n80\n\n" self.assertEqual(ms.base_string, example_bs) self.assertEqual(ms.signature, "6T3zZzy2Emppni6bzL7kdRxUWL4=")
def test_credential_object(self): """Test the credentials object using the IETF Draft values. See: http://tools.ietf.org/html/draft-ietf-oauth-v2-http-mac-01 """ ms = Signature(self.rfc_credentials, host="example.com", port=80, method="GET") ms.sign_request(uri="/resource/1?b=1&a=2", timestamp="1336363200", nonce="dj83hs9s") # Validate that we calculated the base string correctly example_bs = "1336363200\ndj83hs9s\nGET\n/resource/1?b=1&a=2\nexample.com\n80\n\n" self.assertEqual(ms.base_string, example_bs) self.assertEqual(ms.signature, "bhCQXTVyfj5cmA9uKkPFx1zeOXM=")