Esempio n. 1
0
    def test_oidc_callback_endpoint_exist(self):
        endpoints = []
        for item in clientapp.create_app().url_map.iter_rules():
            endpoint = item.rule
            endpoints.append(endpoint)

        self.assertTrue('/oidc_callback' in endpoints,
                        "enpoint /oidc_callback knão existe no app")
Esempio n. 2
0
 def setUp(self):
     self.app = clientapp.create_app()
     self.app.testing = True
     self.app_context = self.app.test_request_context()
     self.app_context.push()
     self.client = self.app.test_client()
     #self.oauth = OAuth(self.app)
     os.environ['AUTHLIB_INSECURE_TRANSPORT'] = "1"
Esempio n. 3
0
    def setUp(self):
        self.app = create_app()
        self.app.testing = True
        self.app_context = self.app.test_request_context(
            base_url="https://chris.testingenv.org")
        self.app_context.push()
        self.client = self.app.test_client()

        #self.oauth = OAuth(self.app)
        os.environ['AUTHLIB_INSECURE_TRANSPORT'] = "1"
        '''
 def setUp(self):
     self.app = clientapp.create_app()
     self.app.testing = True
     self.app_context = self.app.test_request_context()
     self.app_context.push()
     self.client = self.app.test_client()
     #self.oauth = OAuth(self.app)
     os.environ['AUTHLIB_INSECURE_TRANSPORT'] = "1"
     # stashing to restore on teardown
     self.CHd = ClientHandler.discover
     ClientHandler.discover = MagicMock(name='discover')
     # discover will always return a valid data
     ClientHandler.discover.return_value = helper.OP_DATA_DICT_RESPONSE
Esempio n. 5
0
 def test_login_endpoint_should_exist(self):
     self.assertTrue('login' in app_endpoints(clientapp.create_app()),
                     'endpoint /login does not exist in app')
 def test_if_OP_CLIENT_SECRET_is_equal_cfg_CLIENT_ID(self):
     self.assertEqual(clientapp.create_app().config['OP_CLIENT_SECRET'],
                      clientapp.cfg.CLIENT_SECRET)
 def test_if_OP_CLIENT_SECRET_exists_in_app_configuration(self):
     self.assertTrue('OP_CLIENT_SECRET' in clientapp.create_app().config,
                     'No OP_CLIENT_SECRET in app.config')
 def test_if_op_client_id_exists_in_app_configuration(self):
     self.assertTrue('OP_CLIENT_ID' in clientapp.create_app().config,
                     'No OP_CLIENT_ID in app.config')
 def test_if_oauth_is_app_extension(self):
     self.assertTrue('authlib.integrations.flask_client' in
                     clientapp.create_app().extensions)
 def test_if_secret_key_not_none(self):
     self.assertIsNotNone(clientapp.create_app().secret_key,
                          'app secret key is unexpectedly None')
 def test_if_app_has_secret_key(self):
     self.assertTrue(hasattr(clientapp.create_app(), 'secret_key'), )
    def test_create_app_should_return_a_flask_app(self):

        self.assertIsInstance(clientapp.create_app(), Flask,
                              'create_app is not returning a Flask instance')
Esempio n. 13
0
    def test_app_should_contain_protected_content_route(self):

        endpoints = app_endpoint(create_app())
        self.assertIn('protected-content', endpoints,
                      'protected-content route not found in app endpoints')
Esempio n. 14
0
    def test_callback_endpoint_should_exist(self):

        self.assertTrue('callback' in app_endpoints(clientapp.create_app()),
                        'endpoint /callback does not exist in app')
 def test_if_app_has_register_endpoint(self):
     self.assertIn(
         'register',
         helper.app_endpoints(clientapp.create_app())
     )
 def test_create_app_has_configuration(self):
     self.assertTrue(
         'configuration' in app_endpoints(clientapp.create_app()),
         'endpoint /configuration does not exist in app')