Skip to content

The agent that grows with you

feat(release): hold the Store submission until publish

ethernet8c050ce93cfb
diff --git a/.github/workflows/desktop-bundled-release.yml b/.github/workflows/desktop-bundled-release.yml
index 9594705ebca..120b090cb7e 100644
--- a/.github/workflows/desktop-bundled-release.yml
+++ b/.github/workflows/desktop-bundled-release.yml
@@ -2153,7 +2153,9 @@ jobs:
files=(verified/Store-*.msixbundle)
test "${#files[@]}" -eq 1
test -f "${files[0]}"
- msstore publish "${files[0]}" -id "$MS_STORE_PRODUCT_ID"
+ # Auto-publish stays off: the submission is committed with
+ # targetPublishMode Manual and is released by the publication pass.
+ python -m scripts.releases.store submit "${files[0]}"
stable-phase-result:
name: Stable bundle phase completed
diff --git a/.github/workflows/stable-release-publication.yml b/.github/workflows/stable-release-publication.yml
index d6a9f6b9745..5425975575a 100644
--- a/.github/workflows/stable-release-publication.yml
+++ b/.github/workflows/stable-release-publication.yml
@@ -61,3 +61,7 @@ jobs:
CLOUDFLARE_R2_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_R2_SECRET_ACCESS_KEY }}
CLOUDFLARE_R2_BUCKET: ${{ vars.CLOUDFLARE_R2_BUCKET }}
CLOUDFLARE_R2_PUBLIC_URL: ${{ vars.CLOUDFLARE_R2_PUBLIC_URL }}
+ MS_STORE_TENANT_ID: ${{ secrets.MS_STORE_TENANT_ID }}
+ MS_STORE_CLIENT_ID: ${{ secrets.MS_STORE_CLIENT_ID }}
+ MS_STORE_CLIENT_SECRET: ${{ secrets.MS_STORE_CLIENT_SECRET }}
+ MS_STORE_PRODUCT_ID: ${{ vars.MS_STORE_PRODUCT_ID }}
diff --git a/scripts/releases/sequencer.py b/scripts/releases/sequencer.py
index f7de499d1e0..c715bf55d9d 100644
--- a/scripts/releases/sequencer.py
+++ b/scripts/releases/sequencer.py
@@ -336,7 +336,7 @@ def discover(repository: str, run=output) -> list[dict]:
def reconcile(env: dict, *, run=output, read_head=None, advance_head=None,
read_archive=None) -> list[dict]:
"""Converge GitHub publication and protected heads oldest-first."""
- from scripts.releases import channel_releases, docker, stable
+ from scripts.releases import channel_releases, docker, stable, store
repository = env["GITHUB_REPOSITORY"]
# The archive copy is the only authority for the candidate manifest digest;
@@ -389,7 +389,8 @@ def reconcile(env: dict, *, run=output, read_head=None, advance_head=None,
# build that pushed the image under the attempt ref.
docker.promote_stable(record["claim_tag"], record["docker_manifest_digest"])
# The Store release joins the pass here (after the feeds and
- # aliases move), not before.
+ # aliases move), not before. A failure leaves the run red.
+ store.release_from_env(env)
advance_head = production_advance
for step in steps:
diff --git a/scripts/releases/store.py b/scripts/releases/store.py
new file mode 100644
index 00000000000..6637e4a1ec0
--- /dev/null
+++ b/scripts/releases/store.py
@@ -0,0 +1,264 @@
+"""Store submission control for the release pipeline.
+
+The green run submits the verified ``.msixbundle`` with auto-publish off
+(``targetPublishMode: "Manual"``); the publication pass releases it (or turns
+auto-publish on while it is still in certification). Both entry points act on
+the submission's current state, so both are safe to rerun.
+
+Green run — ``python -m scripts.releases.store submit <package>`` (Windows
+runner, ``msstore`` CLI configured beforehand by
+``microsoft/microsoft-store-apppublisher`` + ``msstore reconfigure``):
+
+1. ``msstore submission status <productId>`` — a submission is in flight when
+ its status is not one of the terminal/failure states
+ (``None, Published, PublishFailed, Canceled, CertificationFailed,
+ PreProcessingFailed, CommitFailed``).
+2. ``msstore submission delete <productId> --no-confirm`` — only when one is
+ in flight. Deleting the last published submission would be wrong, so the
+ status gates this.
+3. ``msstore publish <package> --appId <productId> --noCommit`` — uploads the
+ package and leaves the submission as a draft (``--noCommit`` / ``-nc``,
+ "Disables committing the submission, keeping it in draft state").
+4. ``msstore submission get <productId>`` — the complete submission JSON.
+5. ``msstore submission update <productId> <json>`` — the same JSON with
+ ``targetPublishMode: "Manual"``. For MSIX apps ``submission update`` sends
+ the complete submission JSON, so it sets packages and publish mode at once.
+6. ``msstore submission publish <productId>`` — commits; certification starts.
+
+Publication pass — ``scripts.releases.store.release(...)`` (Ubuntu runner,
+Partner Center submission REST API, stdlib ``urllib`` only):
+
+1. ``POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token`` with
+ ``grant_type=client_credentials`` and scope
+ ``https://manage.devcenter.microsoft.com/.default`` (the same MS_STORE_*
+ credentials the CLI uses).
+2. ``POST https://manage.devcenter.microsoft.com/v1.0/my/applications/{id}/submissions``
+ to find the in-flight submission: ``201`` means none existed (the fresh
+ probe draft is deleted immediately with ``DELETE .../submissions/{id}``,
+ nothing else is touched); ``409`` means one exists and its id is in the
+ error body.
+3. ``GET .../submissions/{id}/status``. Terminal or already-live states
+ (``PendingPublication, Publishing, Published``) are a no-op ("already-live").
+4. Otherwise the held submission is released by rewriting it with
+ ``targetPublishMode: "Immediate"`` (``PUT .../submissions/{id}``) and
+ committing it (``POST .../submissions/{id}/commit``). A certified
+ submission (status ``Release``) goes live now ("released"); one still in
+ certification goes live when certification passes ("auto-publish").
+
+Sources for the commands and fields above:
+- msstore CLI commands and options (``submission status/get/update/delete
+ --no-confirm/publish``, ``publish --noCommit``):
+ https://learn.microsoft.com/en-us/windows/apps/publish/msstore-dev-cli/commands
+- CLI CI/CD setup (``msstore reconfigure --tenantId --sellerId --clientId
+ --clientSecret`` on the runner):
+ https://learn.microsoft.com/en-us/windows/apps/publish/msstore-dev-cli/github-actions
+- Submission resource fields (``targetPublishMode``:
+ ``Immediate``/``Manual``/``SpecificDate``) and the status enum
+ (``PendingCommit, CommitStarted, PreProcessing, Certification,
+ CertificationFailed, Release, PendingPublication, Publishing, Published, ...``):
+ https://learn.microsoft.com/en-us/windows/uwp/monetize/manage-app-submissions
+- REST methods (create/update/commit/delete/status):
+ https://learn.microsoft.com/en-us/windows/uwp/monetize/manage-app-submissions#methods-for-managing-app-submissions
+ (individual pages: create-an-app-submission, update-an-app-submission,
+ commit-an-app-submission, delete-an-app-submission,
+ get-status-for-an-app-submission)
+- Azure AD client-credentials token:
+ https://learn.microsoft.com/en-us/windows/uwp/monetize/create-and-manage-submissions-using-windows-store-services#obtain-an-azure-ad-access-token
+
+Unverified on paper but guarded in code: whether the API accepts a ``PUT``
+update on a submission that is committed and held (certified, waiting for
+release). If it refuses, the release step fails and the publication run stays
+red; rerunning after a fix from Partner Center is safe.
+"""
+from __future__ import annotations
+
+import json
+import os
+import subprocess
+import sys
+import urllib.error
+import urllib.parse
+import urllib.request
+
+API_ROOT = "https://manage.devcenter.microsoft.com/v1.0/my"
+TOKEN_URL = "https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token"
+TOKEN_SCOPE = "https://manage.devcenter.microsoft.com/.default"
+
+# Submission statuses that are terminal or already decided; none of them is an
+# in-flight submission the green run would need to clear, and none of them is
+# worth touching at release time except the already-live set below.
+_NOT_IN_FLIGHT = {
+ "None", "Published", "PublishFailed", "Canceled",
+ "CertificationFailed", "PreProcessingFailed", "CommitFailed",
+}
+_ALREADY_LIVE = {"PendingPublication", "Publishing", "Published"}
+# The status of a submission that passed certification and is held by
+# targetPublishMode Manual, waiting for release.
+_CERTIFIED_HELD = "Release"
+
+
+class StoreError(RuntimeError):
+ """A Store CLI or API call failed. The calling run stays red."""
+
+
+def _cli_run(argv: list[str]) -> str:
+ result = subprocess.run(argv, capture_output=True, text=True)
+ if result.returncode != 0:
+ raise StoreError(f"{' '.join(argv)} failed: {result.stderr.strip()}")
+ return result.stdout
+
+
+def _has_in_flight(status_output: str) -> bool:
+ try:
+ status = json.loads(status_output)
+ except json.JSONDecodeError:
+ raise StoreError(f"unreadable submission status: {status_output!r}")
+ if not isinstance(status, dict) or "status" not in status:
+ raise StoreError(f"unreadable submission status: {status_output!r}")
+ return status["status"] not in _NOT_IN_FLIGHT
+
+
+def submit(package: str, *, product_id: str, run=_cli_run) -> dict:
+ """Submit ``package`` with auto-publish off, clearing any in-flight one."""
+ if _has_in_flight(run(["msstore", "submission", "status", product_id])):
+ run(["msstore", "submission", "delete", product_id, "--no-confirm"])
+ run(["msstore", "publish", package, "--appId", product_id, "--noCommit"])
+ submission = json.loads(run(["msstore", "submission", "get", product_id]))
+ submission["targetPublishMode"] = "Manual"
+ run(["msstore", "submission", "update", product_id,
+ json.dumps(submission, separators=(",", ":"))])
+ run(["msstore", "submission", "publish", product_id])
+ return {"productId": product_id, "targetPublishMode": "Manual"}
+
+
+def _http_run(request: dict) -> dict:
+ """Default injected runner: one HTTP request, stdlib only."""
+ url = request["url"]
+ data = None
+ headers = {"Content-Type": "application/json"}
+ body = request.get("body")
+ if body is not None:
+ data = json.dumps(body).encode()
+ if "form" in request:
+ data = urllib.parse.urlencode(request["form"]).encode()
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
+ req = urllib.request.Request(url, data=data, headers=headers,
+ method=request["method"])
+ try:
+ with urllib.request.urlopen(req) as response:
+ raw = response.read().decode()
+ return {"status": response.status,
+ "body": json.loads(raw) if raw else ""}
+ except urllib.error.HTTPError as error:
+ raw = error.read().decode()
+ try:
+ parsed = json.loads(raw) if raw else {}
+ except json.JSONDecodeError:
+ parsed = {"message": raw}
+ return {"status": error.code, "body": parsed}
+
+
+def _token(tenant_id: str, client_id: str, client_secret: str, run) -> str:
+ response = run({"method": "POST", "url": TOKEN_URL.format(tenant=tenant_id),
+ "form": {
+ "grant_type": "client_credentials",
+ "client_id": client_id,
+ "client_secret": client_secret,
+ "scope": TOKEN_SCOPE,
+ }})
+ if response["status"] != 200 or "access_token" not in response["body"]:
+ raise StoreError(f"token request failed: {response['status']}")
+ return response["body"]["access_token"]
+
+
+def _in_progress_id(conflict_body) -> str:
+ """The 409 body names the in-progress submission; pull its id out."""
+ text = json.dumps(conflict_body) if not isinstance(conflict_body, str) \
+ else conflict_body
+ digits = "".join(character if character.isdigit() or character == " "
+ else " " for character in text).split()
+ long_ids = [token for token in digits if len(token) >= 10]
+ if not long_ids:
+ raise StoreError(f"cannot find the in-flight submission id in {text!r}")
+ return long_ids[0]
+
+
+def release(*, product_id: str, tenant_id: str, client_id: str,
+ client_secret: str, run=_http_run) -> str:
+ """Release the held submission, or let it go live when certified."""
+ token = _token(tenant_id, client_id, client_secret, run)
+
+ def call(method: str, path: str, body: dict | None = None) -> dict:
+ request = {"method": method, "url": API_ROOT + path}
+ if body is not None:
+ request["body"] = body
+ request["headers"] = {"Authorization": f"Bearer {token}"}
+ return run(request)
+
+ submissions_path = f"/applications/{product_id}/submissions"
+ probe = call("POST", submissions_path)
+ if probe["status"] == 201:
+ # Nothing was in flight; do not leave the probe draft behind.
+ probe_id = probe["body"].get("id")
+ if probe_id:
+ call("DELETE", f"{submissions_path}/{probe_id}")
+ return "no-submission"
+ if probe["status"] != 409:
+ raise StoreError(f"unexpected submission probe reply: {probe['status']}")
+ submission_id = _in_progress_id(probe["body"])
+
+ status = call("GET", f"{submissions_path}/{submission_id}/status")
+ if status["status"] != 200:
+ raise StoreError(f"submission status failed: {status['status']}")
+ state = status["body"]["status"]
+ if state in _ALREADY_LIVE:
+ return "already-live"
+
+ submission = call("GET", f"{submissions_path}/{submission_id}")
+ if submission["status"] != 200:
+ raise StoreError(f"submission read failed: {submission['status']}")
+ held = submission["body"]
+ held["targetPublishMode"] = "Immediate"
+ updated = call("PUT", f"{submissions_path}/{submission_id}", held)
+ if updated["status"] != 200:
+ raise StoreError(f"submission update failed: {updated['status']}")
+ committed = call("POST", f"{submissions_path}/{submission_id}/commit")
+ if committed["status"] != 200:
+ raise StoreError(f"submission commit failed: {committed['status']}")
+ return "released" if state == _CERTIFIED_HELD else "auto-publish"
+
+
+def release_from_env(env: dict, run=_http_run) -> str:
+ """Release the Store submission when the environment configures it."""
+ product_id = env.get("MS_STORE_PRODUCT_ID")
+ if not product_id:
+ print("Store release skipped: MS_STORE_PRODUCT_ID is not configured.",
+ file=sys.stderr)
+ return "not-configured"
+ return release(
+ product_id=product_id,
+ tenant_id=env["MS_STORE_TENANT_ID"],
+ client_id=env["MS_STORE_CLIENT_ID"],
+ client_secret=env["MS_STORE_CLIENT_SECRET"],
+ run=run,
+ )
+
+
+def main(argv: list[str]) -> int:
+ if len(argv) >= 2 and argv[0] == "submit":
+ product_id = os.environ["MS_STORE_PRODUCT_ID"]
+ package = argv[1]
+ result = submit(package, product_id=product_id)
+ print(json.dumps(result, sort_keys=True))
+ return 0
+ if argv[:1] == ["release"]:
+ print(json.dumps({"result": release_from_env(dict(os.environ))},
+ sort_keys=True))
+ return 0
+ print("usage: python -m scripts.releases.store submit <package> | release",
+ file=sys.stderr)
+ return 2
+
+
+if __name__ == "__main__":
+ raise SystemExit(main(sys.argv[1:]))
diff --git a/tests/scripts/test_release_sequencer.py b/tests/scripts/test_release_sequencer.py
index de2f69ccd5e..b898e986666 100644
--- a/tests/scripts/test_release_sequencer.py
+++ b/tests/scripts/test_release_sequencer.py
@@ -411,6 +411,37 @@ def test_reconcile_discovers_custody_flips_then_advances_oldest_first():
assert release["tag_name"] == f"v{version}" and release["draft"] is False
+def test_the_store_release_joins_the_pass_after_the_aliases_move(monkeypatch):
+ from scripts.releases import channel_releases, docker, sequencer, store
+
+ manifest_digest = hashlib.sha256(b"m").hexdigest()
+ _tags, releases, run = _sequencer_fixture(
+ "0.21.5", manifest_digest=manifest_digest, drafts_on_claim_tag=True)
+ events = []
+ head = ["0.21.4"]
+ monkeypatch.setattr(
+ channel_releases, "advance_stable",
+ lambda env, record, root: (head.append(record["version"]),
+ events.append(("feed", record["version"]))))
+ monkeypatch.setattr(
+ docker, "promote_stable",
+ lambda claim_tag, digest: events.append(("aliases", claim_tag)))
+ seen_env = []
+ monkeypatch.setattr(
+ store, "release_from_env",
+ lambda env: seen_env.append(env) or events.append(("store",)))
+
+ steps = sequencer.reconcile(
+ {"GITHUB_REPOSITORY": "example/project", "MS_STORE_PRODUCT_ID": "9NTEST"},
+ run=run, read_head=lambda: head[-1], advance_head=None,
+ read_archive=lambda _key: b"m",
+ )
+
+ assert steps == [{"advance": "0.21.5"}]
+ assert events == [("feed", "0.21.5"), ("aliases", "rc.1-v0.21.5"), ("store",)]
+ assert seen_env[0]["MS_STORE_PRODUCT_ID"] == "9NTEST"
+
+
def test_a_publish_that_died_before_the_retarget_is_repaired():
from scripts.releases.sequencer import reconcile
diff --git a/tests/scripts/test_release_store.py b/tests/scripts/test_release_store.py
new file mode 100644
index 00000000000..f726b260477
--- /dev/null
+++ b/tests/scripts/test_release_store.py
@@ -0,0 +1,207 @@
+"""The Store submission is held until publish and is safe to rerun."""
+import json
+
+import pytest
+
+
+class _Cli:
+ """Stands in for the msstore CLI. Records every argv it is handed."""
+
+ def __init__(self, pending):
+ self.events = []
+ self.pending = pending
+
+ def __call__(self, argv):
+ name = " ".join(argv)
+ if argv[:3] == ["msstore", "submission", "status"]:
+ self.events.append(("status", name))
+ return json.dumps(
+ {"status": "Certification"} if self.pending
+ else {"status": "Published"})
+ if argv[:3] == ["msstore", "submission", "get"]:
+ self.events.append(("get", name))
+ return json.dumps({
+ "targetPublishMode": "Immediate", "friendlyName": "Submission 2",
+ "listings": {}})
+ if argv[:3] == ["msstore", "submission", "delete"]:
+ self.events.append(("delete-pending", name))
+ return ""
+ if argv[:3] == ["msstore", "submission", "update"]:
+ self.events.append(("update", name))
+ self.updated = json.loads(argv[4])
+ return ""
+ if argv[:3] == ["msstore", "submission", "publish"]:
+ self.events.append(("commit", name))
+ return ""
+ if argv[:2] == ["msstore", "publish"]:
+ self.events.append(("submit", name))
+ return ""
+ raise AssertionError(argv)
+
+ def names(self):
+ return [name for _kind, name in self.events]
+
+
+def _index(names, prefix):
+ return next(index for index, name in enumerate(names)
+ if name.startswith(prefix))
+
+
+def test_submit_deletes_the_in_flight_submission_first():
+ from scripts.releases.store import submit
+
+ cli = _Cli(pending=True)
+ submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)
+ names = cli.names()
+ assert _index(names, "msstore submission delete") \
+ < _index(names, "msstore publish ")
+ assert _index(names, "msstore submission delete") \
+ < _index(names, "msstore submission publish")
+
+
+def test_submit_skips_the_delete_when_nothing_is_in_flight():
+ from scripts.releases.store import submit
+
+ cli = _Cli(pending=False)
+ submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)
+ assert not any(name.startswith("msstore submission delete")
+ for name in cli.names())
+
+
+def test_submit_turns_auto_publish_off():
+ from scripts.releases.store import submit
+
+ cli = _Cli(pending=False)
+ submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)
+ assert cli.updated["targetPublishMode"] == "Manual"
+
+
+def test_submit_commits_the_held_submission():
+ from scripts.releases.store import submit
+
+ cli = _Cli(pending=False)
+ submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)
+ names = cli.names()
+ assert _index(names, "msstore submission update") \
+ < _index(names, "msstore submission publish")
+ assert names[-1].startswith("msstore submission publish")
+
+
+def test_submit_keeps_the_submission_in_draft_until_the_mode_is_set():
+ from scripts.releases.store import submit
+
+ cli = _Cli(pending=False)
+ submit("verified/Store-1.2.3.msixbundle", product_id="9NTEST", run=cli)
+ submit_call = next(name for name in cli.names() if name.startswith("msstore publish"))
+ assert "--noCommit" in submit_call
+ assert _index(cli.names(), "msstore publish ") \
+ < _index(cli.names(), "msstore submission update")
+
+
+class _Api:
+ """Stands in for the Partner Center submission REST API."""
+
+ def __init__(self, status, in_flight=True, fail_update=False):
+ self.requests = []
+ self.status = status
+ self.in_flight = in_flight
+ self.fail_update = fail_update
+ self.updated = None
+ self.committed = False
+
+ def __call__(self, request):
+ self.requests.append(request)
+ url, method = request["url"], request["method"]
+ if url.endswith("/token"):
+ return {"status": 200, "body": {"access_token": "tok"}}
+ if url.endswith("/submissions") and method == "POST":
+ if self.in_flight:
+ return {
+ "status": 409,
+ "body": {"code": "InvalidOperation", "message":
+ "The app already has an in-progress submission: "
+ "1152921504621243540"},
+ }
+ return {"status": 201, "body": {"id": "probe", "status": "PendingCommit"}}
+ if url.endswith("/status") and method == "GET":
+ return {"status": 200, "body": {"status": self.status}}
+ if "/submissions/" in url and method == "GET":
+ return {"status": 200, "body": {
+ "id": "1152921504621243540", "targetPublishMode": "Manual",
+ "friendlyName": "Submission 2"}}
+ if "/submissions/" in url and method == "DELETE":
+ return {"status": 204, "body": ""}
+ if "/submissions/" in url and method == "PUT":
+ if self.fail_update:
+ return {"status": 500, "body": {"code": "ServiceError"}}
+ self.updated = request["body"]
+ return {"status": 200, "body": {"id": "1152921504621243540"}}
+ if url.endswith("/commit") and method == "POST":
+ self.committed = True
+ return {"status": 200, "body": {"status": "CommitStarted"}}
+ raise AssertionError(request)
+
+
+def _release(status, **kwargs):
+ from scripts.releases.store import release
+
+ api = _Api(status, **kwargs)
+ result = release(product_id="9NTEST", tenant_id="T", client_id="C",
+ client_secret="S", run=api)
+ return api, result
+
+
+def test_release_publishes_a_certified_submission():
+ api, result = _release("Release")
+ assert result == "released"
+ assert api.updated["targetPublishMode"] == "Immediate"
+ assert api.committed is True
+
+
+def test_release_turns_auto_publish_on_when_not_certified():
+ api, result = _release("Certification")
+ assert result == "auto-publish"
+ assert api.updated["targetPublishMode"] == "Immediate"
+ assert api.committed is True
+
+
+def test_release_is_a_noop_when_the_submission_already_goes_live():
+ api, result = _release("PendingPublication")
+ assert result == "already-live"
+ assert api.updated is None and api.committed is False
+
+
+def test_release_without_an_in_flight_submission_deletes_its_probe_draft():
+ api, result = _release("Certification", in_flight=False)
+ assert result == "no-submission"
+ deleted = [r for r in api.requests
+ if r["method"] == "DELETE" and "/submissions/" in r["url"]]
+ assert len(deleted) == 1
+ assert api.committed is False
+
+
+def test_a_failed_store_call_leaves_the_run_red():
+ from scripts.releases.store import StoreError
+
+ with pytest.raises(StoreError):
+ _release("Certification", fail_update=True)
+def test_release_from_env_skips_when_the_store_is_not_configured(capsys):
+ from scripts.releases.store import release_from_env
+
+ assert release_from_env({}) == "not-configured"
+
+
+def test_release_from_env_passes_the_configured_credentials():
+ from scripts.releases.store import release_from_env
+
+ api = _Api("Release")
+ env = {
+ "MS_STORE_PRODUCT_ID": "9NTEST",
+ "MS_STORE_TENANT_ID": "TENANT",
+ "MS_STORE_CLIENT_ID": "CLIENT",
+ "MS_STORE_CLIENT_SECRET": "SECRET",
+ }
+ assert release_from_env(env, run=api) == "released"
+ token = next(r for r in api.requests if r["url"].endswith("/token"))
+ assert token["form"]["client_id"] == "CLIENT"
+ assert token["form"]["client_secret"] == "SECRET"