async def test_app_uninstalled(self): app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, installation_store=MyInstallationStore(), ) event_payload = { "token": "verification-token", "enterprise_id": "E111", "api_app_id": "A111", "event": { "type": "app_uninstalled" }, "type": "event_callback", "event_id": "Ev111", "event_time": 1606805974, } timestamp, body = str(int(time())), json.dumps(event_payload) request: AsyncBoltRequest = AsyncBoltRequest( body=body, headers=self.build_headers(timestamp, body)) response = await app.async_dispatch(request) assert response.status == 404 # Enable the built-in event listeners app.enable_token_revocation_listeners() response = await app.async_dispatch(request) assert response.status == 200 # auth.test API call must be skipped await assert_auth_test_count_async(self, 0) await asyncio.sleep(1) # wait a bit after auto ack() assert app.installation_store.delete_bot_called is True assert app.installation_store.delete_installation_called is True assert app.installation_store.delete_all_called is True
async def test_no_installation_store(self): self.web_client.token = valid_token app = AsyncApp( client=self.web_client, signing_secret=self.signing_secret, ) with pytest.raises(BoltError): app.default_tokens_revoked_event_listener() with pytest.raises(BoltError): app.default_app_uninstalled_event_listener() with pytest.raises(BoltError): app.enable_token_revocation_listeners()