コード例 #1
0
def test_create_signed_jwt(key_config):
    key_config.content = get_resource_content("key/private_key.pem")
    key_config.path = get_resource_filepath("key/private_key.pem")

    assert key_config._content is None
    assert key_config._path is not None
    assert create_signed_jwt(key_config, "test_bot") is not None
コード例 #2
0
    async def _authenticate_and_retrieve_app_session_token(self) -> str:
        jwt = create_signed_jwt(self._app_config.private_key,
                                self._app_config.app_id)
        req = AuthenticateRequest(token=jwt)

        token = await self._authentication_api.pubkey_app_authenticate_post(req
                                                                            )
        return token.token
コード例 #3
0
    async def _authenticate_and_get_token(self, api_client: ApiClient) -> str:
        jwt = create_signed_jwt(self._bot_config.private_key,
                                self._bot_config.username)
        req = AuthenticateRequest(token=jwt)

        token = await AuthenticationApi(api_client).pubkey_authenticate_post(
            req)
        return token.token
def test_create_signed_jwt_from_path(key_config, rsa_key):
    private_key_path = "private_key_path/private_key.pem"
    key_config.path = private_key_path

    mock_open = mock.mock_open(read_data=rsa_key)

    with mock.patch('builtins.open', mock_open):
        assert create_signed_jwt(key_config, "test_bot") is not None
        mock_open.assert_called_with(private_key_path, "r")
コード例 #5
0
def test_create_signed_jwt_from_content(key_config):
    key_config.content = get_resource_content("key/private_key.pem")

    assert create_signed_jwt(key_config, "test_bot") is not None
コード例 #6
0
def test_create_signed_jwt_from_path(key_config):
    key_config.path = get_resource_filepath("key/private_key.pem")

    assert create_signed_jwt(key_config, "test_bot") is not None
def test_create_signed_jwt_from_content(key_config, rsa_key):
    key_config.content = rsa_key

    assert create_signed_jwt(key_config, "test_bot") is not None