def test_handle_installation(self): oauth_flow = OAuthFlow(settings=OAuthSettings( client_id="111.222", client_secret="xxx", scopes=["chat:write", "commands"], installation_store=FileInstallationStore(), state_store=FileOAuthStateStore(expiration_seconds=120), )) req = BoltRequest(body="") resp = oauth_flow.handle_installation(req) assert resp.status == 200 assert resp.headers.get("content-type") == ["text/html; charset=utf-8"] assert resp.headers.get("content-length") == ["565"] assert "https://slack.com/oauth/v2/authorize?state=" in resp.body
def test_handle_installation_no_rendering(self): oauth_flow = OAuthFlow(settings=OAuthSettings( client_id="111.222", client_secret="xxx", scopes=["chat:write", "commands"], user_scopes=["search:read"], installation_store=FileInstallationStore(), install_page_rendering_enabled=False, # disabled state_store=FileOAuthStateStore(expiration_seconds=120), )) req = BoltRequest(body="") resp = oauth_flow.handle_installation(req) assert resp.status == 302 location_header = resp.headers.get("location")[0] assert "https://slack.com/oauth/v2/authorize?state=" in location_header