@@ -0,0 +1,2796 @@
+from datetime import timedelta%0Afrom unittest.case import TestCase%0A%0Afrom zsl.application.containers.container import IoCContainer%0Afrom zsl.application.modules.context_module import DefaultContextModule%0Afrom zsl.application.modules.logger_module import LoggerModule%0Afrom zsl.testing.zsl import ZslTestCase%0Afrom zsl.testing.zsl import ZslTestConfiguration%0A%0Afrom zsl_jwt.codec import ZslJwtExpiredSignatureError%0Afrom zsl_jwt.codec import ZslJwtInvalidAudienceError%0Afrom zsl_jwt.codec import ZslJwtInvalidNbfClaimError%0Afrom zsl_jwt.codec import decode%0Afrom zsl_jwt.codec import encode%0Afrom zsl_jwt.configuration import JWTConfiguration%0Afrom zsl_jwt.configuration import JWTProfile%0Afrom zsl_jwt.module import JWTModule%0A%0A%0Aclass ZslJwtContainer(IoCContainer):%0A    logger = LoggerModule%0A    context = DefaultContextModule%0A    jwt_module = JWTModule%0A%0A%0Aclass TestEncode(ZslTestCase, TestCase):%0A    SECRET = 'secret'%0A    PAYLOAD = %7B'a': 'b', 'c': %7B'd': 'e'%7D%7D%0A    ZSL_TEST_CONFIGURATION = ZslTestConfiguration(%0A        app_name='zsl_jwt_encode_test',%0A        container=ZslJwtContainer,%0A        config_object=%7B%0A            JWTModule.JWT_CONFIG_NAME: JWTConfiguration(%0A                default_secret=SECRET,%0A                profiles=%7B%0A                    'fail_nbf_claim': JWTProfile(%0A                        SECRET,%0A                        not_before=timedelta(seconds=30),%0A                        audience='fail_nbf_claim'%0A                    ),%0A                    'fail_exp_claim': JWTProfile(%0A                        SECRET,%0A                        expiration=timedelta(seconds=-30),%0A                        audience='fail_exp_claim'%0A                    ),%0A                    'correct': JWTProfile(%0A                        SECRET,%0A                        audience='correct'%0A                    ),%0A                %7D%0A            )%0A        %7D%0A    )%0A%0A    def testEncodeDefaultProfile(self):%0A        token = encode(TestEncode.PAYLOAD)%0A        decoded_payload = decode(token)%0A        self.assertEqual(TestEncode.PAYLOAD, decoded_payload,%0A                         %22The encoding/decoding process must result the %22%0A                         %22original payload.%22)%0A%0A    def testEncodeInvalidAudienceClaim(self):%0A        token = encode(TestEncode.PAYLOAD)%0A        with self.assertRaises(ZslJwtInvalidAudienceError):%0A            decode(token, profile='correct')%0A%0A    def testEncodeInvalidNotBeforeClaim(self):%0A        token = encode(TestEncode.PAYLOAD, profile='fail_nbf_claim')%0A        with self.assertRaises(ZslJwtInvalidNbfClaimError):%0A            decode(token, profile='fail_nbf_claim')%0A%0A    def testEncodeExpiredSignatureClaim(self):%0A        token = encode(TestEncode.PAYLOAD, profile='fail_exp_claim')%0A        with self.assertRaises(ZslJwtExpiredSignatureError):%0A            decode(token, profile='fail_exp_claim')%0A

Add unit tests