def test_get_mac_signature_against_example_from_spec(self):
     # This is the example used in Section 1.1 of RFC-TODO
     req = "GET /resource/1?b=1&a=2 HTTP/1.1\r\n" "Host: example.com\r\n" "\r\n"
     params = {"id": "h480djs93hd8", "ts": "1336363200", "nonce": "dj83hs9s"}
     secret = "489dks293j39"
     sigstr = "1336363200\n" "dj83hs9s\n" "GET\n" "/resource/1?b=1&a=2\n" "example.com\n" "80\n" "\n"
     sig = "bhCQXTVyfj5cmA9uKkPFx1zeOXM="
     req = Request.from_string(req)
     mysigstr = get_normalized_request_string(req, params)
     self.assertEquals(sigstr, mysigstr)
     mysig = get_mac_signature(req, secret, params)
 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.
     token, secret = (
         "vmo1txkttblmn51u2p3zk2xiy16hgvm5ok8qiv1yyi86ffjzy9zj0ez9x6wnvbx7",
         "b8u1cc5iiio5o319og7hh8faf2gi5ym4aq0zwf112cv1287an65fudu5zj7zo7dz",
     )
     req = "GET /alias/ HTTP/1.1\r\nHost: 10.250.2.176\r\n\r\n"
     req = Request.from_string(req)
     req.authorization = ("MAC", {"ts": "1329181221", "nonce": "wGX71"})
     sig = "jzh5chjQc2zFEvLbyHnPdX11Yck="
     mysig = get_mac_signature(req, secret)
     self.assertEquals(sig, mysig)
 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.
     token, secret = (
         "vmo1txkttblmn51u2p3zk2xiy16hgvm5ok8qiv1yyi86ffjzy9zj0ez9x6wnvbx7",
         "b8u1cc5iiio5o319og7hh8faf2gi5ym4aq0zwf112cv1287an65fudu5zj7zo7dz",
     )
     req = "GET /alias/ HTTP/1.1\r\nHost: 10.250.2.176\r\n\r\n"
     req = Request.from_string(req)
     req.authorization = ("MAC", {"ts": "1329181221", "nonce": "wGX71"})
     sig = "jzh5chjQc2zFEvLbyHnPdX11Yck="
     mysig = get_mac_signature(req, secret)
     self.assertEquals(sig, mysig)
 def test_get_mac_signature_against_example_from_spec(self):
     # This is the example used in Section 1.1 of RFC-TODO
     req = "GET /resource/1?b=1&a=2 HTTP/1.1\r\n"\
           "Host: example.com\r\n"\
           "\r\n"
     params = {
         "id": "h480djs93hd8",
         "ts": "1336363200",
         "nonce": "dj83hs9s"
     }
     secret = "489dks293j39"
     sigstr = "1336363200\n"\
              "dj83hs9s\n"\
              "GET\n"\
              "/resource/1?b=1&a=2\n"\
              "example.com\n"\
              "80\n"\
              "\n"
     sig = "bhCQXTVyfj5cmA9uKkPFx1zeOXM="
     req = Request.from_string(req)
     mysigstr = get_normalized_request_string(req, params)
     self.assertEquals(sigstr, mysigstr)
     mysig = get_mac_signature(req, secret, params)