Пример #1
0
def test_put_bundle_on_empty_set():
    jwt_bundle_set = JwtBundleSet({})

    assert len(jwt_bundle_set._bundles) == 0

    jwt_bundle = JwtBundle(trust_domain_1, authorities)

    jwt_bundle_set.put(jwt_bundle)

    assert len(jwt_bundle_set._bundles) == 1
    assert list(jwt_bundle_set._bundles.keys())[0].name() == trust_domain_1.name()
Пример #2
0
def test_put_replace_bundle_for_trust_domain():
    jwt_bundle = JwtBundle(trust_domain_1, authorities)
    jwt_bundle_set = JwtBundleSet({trust_domain_1: jwt_bundle})

    assert len(jwt_bundle_set._bundles) == 1
    assert jwt_bundle_set._bundles[trust_domain_1] == jwt_bundle

    new_jwt_bundle = JwtBundle(trust_domain_1, authorities)
    jwt_bundle_set.put(new_jwt_bundle)

    assert len(jwt_bundle_set._bundles) == 1
    assert jwt_bundle_set._bundles[trust_domain_1] == new_jwt_bundle