Beispiel #1
0
    def test_claim_names_and_claim_set_keys_equal(self):
        """
            Assert that the set of claim names is exactly the same as the set of claim set keys (if empty claims are
            included).

            Expected Result: The set of claim names equals the set of claim set keys.
        """

        easyjwt = EasyJWT(self.key)
        claim_names = easyjwt._get_claim_names()
        claim_set = easyjwt._get_claim_set(with_empty_claims=True)
        self.assertSetEqual(claim_names, set(claim_set.keys()))
Beispiel #2
0
    def test_get_claim_names_strict_verification(self):
        """
            Test getting the set of claim names with strict verification enabled.

            Expected Result: A set with the claim names for the `EasyJWT` class and all optional claims returned.
        """

        claim_names = {
            '_easyjwt_class', 'aud', 'exp', 'iat', 'iss', 'jti', 'nbf', 'sub'
        }
        easyjwt = EasyJWT(self.key)
        self.assertSetEqual(claim_names, easyjwt._get_claim_names())