def test_ver_simple():
    # example values supplied by the XEP
    ident = (("client", "pc"), )
    feat = ("http://jabber.org/protocol/disco#info",
            "http://jabber.org/protocol/disco#items",
            "http://jabber.org/protocol/muc",
           )

    assert capat.generate_ver(ident, feat) == "8RovUdtOmiAjzj+xI7SK5BCw3A8="
示例#2
0
def test_ver_simple():
    # example values supplied by the XEP
    ident = (("client", "pc"), )
    feat = (
        "http://jabber.org/protocol/disco#info",
        "http://jabber.org/protocol/disco#items",
        "http://jabber.org/protocol/muc",
    )

    assert capat.generate_ver(ident, feat) == "8RovUdtOmiAjzj+xI7SK5BCw3A8="
def test_ver_complex():
    # this test should verify that ordering works properly
    ident = (("client", "animal"),
             ("client", "bear"), # type ordering after category ordering
             ("apples", "bar"),
             ("apple", "foo"), # "apples" starts with "apple"
                               # thus it's greater
            )
    feat = ()

    expected = capat.hash_new('sha1')
    expected.update("apple/foo<apples/bar<client/animal<client/bear<")
    expected = capat.base64.b64encode(expected.digest())
    assert capat.generate_ver(ident, feat) == expected
示例#4
0
def test_ver_complex():
    # this test should verify that ordering works properly
    ident = (
        ("client", "animal"),
        ("client", "bear"),  # type ordering after category ordering
        ("apples", "bar"),
        ("apple", "foo"),  # "apples" starts with "apple"
        # thus it's greater
    )
    feat = ()

    expected = capat.hash_new('sha1')
    expected.update("apple/foo<apples/bar<client/animal<client/bear<")
    expected = capat.base64.b64encode(expected.digest())
    assert capat.generate_ver(ident, feat) == expected