Skip to content

Commit 469bd49

Browse files
committed
test(reporting): source live token from TEST_SQUARE_REPORTING (prod)
1 parent 358cfb0 commit 469bd49

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
runs-on: ubuntu-latest
3333
env:
3434
TEST_SQUARE_TOKEN: ${{ secrets.TEST_SQUARE_TOKEN }}
35+
TEST_SQUARE_REPORTING: ${{ secrets.TEST_SQUARE_REPORTING }}
3536
steps:
3637
- name: Checkout repo
3738
uses: actions/checkout@v3

‎tests/integration/test_reporting.py‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
The Reporting API is a beta, bespoke offering served ONLY from production
44
(connect.squareup.com/reporting) -- it is not routed on sandbox (which 404s),
55
and a sandbox token 401s against prod. Validating it live therefore needs a
6-
production, reporting-provisioned ``TEST_SQUARE_TOKEN``. CI's token is
7-
sandbox-only, so this suite is gated behind ``TEST_SQUARE_REPORTING`` and skips
8-
by default, keeping CI green. The endpoints exercised are read-only (schema
6+
production, reporting-provisioned access token. CI's regular ``TEST_SQUARE_TOKEN``
7+
is sandbox-only, so this suite is gated behind ``TEST_SQUARE_REPORTING`` -- which
8+
is itself the prod, reporting-provisioned token -- and skips by default when it is
9+
unset, keeping CI green. The endpoints exercised are read-only (schema
910
discovery + queries). The polling *logic* is covered without a live account in
1011
``test_reporting_helper.py``.
1112
1213
Run it against a real prod account:
1314
14-
TEST_SQUARE_REPORTING=1 TEST_SQUARE_TOKEN=<prod-access-token> \
15+
TEST_SQUARE_REPORTING=<prod-reporting-token> \
1516
poetry run pytest tests/integration/test_reporting.py
1617
# Override the host with TEST_SQUARE_BASE_URL=<url> if reporting moves.
1718
"""
@@ -26,14 +27,14 @@
2627

2728
pytestmark = pytest.mark.skipif(
2829
not os.getenv("TEST_SQUARE_REPORTING"),
29-
reason="Set TEST_SQUARE_REPORTING to run the live Reporting API suite (needs a prod, reporting-provisioned token).",
30+
reason="Set TEST_SQUARE_REPORTING to a prod, reporting-provisioned token to run the live Reporting API suite.",
3031
)
3132

3233

3334
def reporting_client() -> Square:
34-
token = os.getenv("TEST_SQUARE_TOKEN")
35+
token = os.getenv("TEST_SQUARE_REPORTING")
3536
if not token:
36-
raise RuntimeError("TEST_SQUARE_TOKEN must be set to run the reporting integration suite.")
37+
raise RuntimeError("TEST_SQUARE_REPORTING must be set to a prod, reporting-provisioned token to run the reporting integration suite.")
3738
# Reporting only exists on production; allow overriding the host via TEST_SQUARE_BASE_URL.
3839
base_url = os.getenv("TEST_SQUARE_BASE_URL")
3940
if base_url:

0 commit comments

Comments
 (0)