def test_compatability_with_ff_sync_client(self): # These are test values used in the FF Sync Client testsuite. # Trying to make sure we're compatible. id, key = ( "vmo1txkttblmn51u2p3zk2xiy16hgvm5ok8qiv1yyi86ffjzy9zj0ez9x6wnvbx7", "b8u1cc5iiio5o319og7hh8faf2gi5ym4aq0zwf112cv1287an65fudu5zj7zo7dz", ) req = b"GET /alias/ HTTP/1.1\r\nHost: 10.250.2.176\r\n\r\n" req = Request.from_bytes(req) req.authorization = ("MAC", {"ts": "1329181221", "nonce": "wGX71"}) sig = "jzh5chjQc2zFEvLbyHnPdX11Yck=" mysig = get_signature(req, key) self.assertEquals(sig, mysig)
def test_get_signature_against_example_from_spec(self): # This is the example used in Section 1.1 of RFC-TODO req = b"GET /resource/1?b=1&a=2 HTTP/1.1\r\n"\ b"Host: example.com\r\n"\ b"\r\n" params = { "id": "h480djs93hd8", "ts": "1336363200", "nonce": "dj83hs9s" } key = "489dks293j39" sig = "bhCQXTVyfj5cmA9uKkPFx1zeOXM=" req = Request.from_bytes(req) mysig = get_signature(req, key, params=params) # XXX: disagrees with spec, but I'm wondering if spec is broken..? if False: self.assertEquals(sig, mysig) # pragma: nocover