Пример #1
0
def test_cookie_dealer_1():
    cd = CookieDealer(DummyServer())
    kaka = cd.create_cookie("Something to pass along", "sso", "Foobar")
    #print kaka
    value, _ts, typ = cd.get_cookie_value(kaka[1], "Foobar")
    assert value == "Something to pass along"
    assert typ == "sso"
Пример #2
0
def test_cookie_dealer_1():
    cd = CookieDealer(DummyServer())
    kaka = cd.create_cookie("Something to pass along", "sso", "Foobar")
    # print kaka
    value, _ts, typ = cd.get_cookie_value(kaka[1], "Foobar")
    assert value == "Something to pass along"
    assert typ == "sso"
Пример #3
0
    def test_create_cookie_value_no_secure(self):
        cookie_value = "Something to pass along"
        cookie_typ = "sso"
        cookie_name = "Foobar"

        class DummyServer:
            def __init__(self):
                self.symkey = b"0123456789012345"

        cookie_dealer = CookieDealer(DummyServer(), secure=False)
        kaka = cookie_dealer.create_cookie(cookie_value, cookie_typ, cookie_name)
        value, timestamp, typ = cookie_dealer.get_cookie_value(kaka[1], "Foobar")

        assert (value, typ) == (cookie_value, cookie_typ)
        t = SimpleCookie()
        t.load(kaka[1])
        morsel = t["Foobar"]
        assert not morsel["secure"]
        assert morsel["httponly"]