fix: satisfy SDK compliance harness 0.8.0#699
Conversation
|
Reviews (1): Last reviewed commit: "chore: add SDK compliance harness 0.8.0" | Re-trigger Greptile |
| def test_flags_request_uses_token_field_for_project_api_key(): | ||
| mock_response = mock.MagicMock() | ||
| mock_response.status_code = 200 | ||
| mock_response.json.return_value = {"featureFlags": {}} | ||
|
|
||
| with mock.patch.object(request_module, "post", return_value=mock_response) as mock_post: | ||
| flags(TEST_API_KEY, host="https://test.posthog.com", distinct_id="user_1") | ||
|
|
||
| mock_post.assert_called_once() | ||
| assert mock_post.call_args.kwargs["api_key_field"] == "token" | ||
|
|
||
|
|
There was a problem hiding this comment.
Non-parameterised test for a parameterisable case
The team's convention is to prefer parameterised tests. The new test covers one scenario (flags() sending "token"); a natural companion case — that plain post() defaults to "api_key" — is left untested. Expressing both as a @pytest.mark.parametrize block would keep them together, make the contract explicit, and make adding future cases (e.g. a hypothetical batch_post variant) straightforward.
Context Used: Do not attempt to comment on incorrect alphabetica... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
posthog-python Compliance ReportDate: 2026-06-27 12:41:06 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
Problem
The SDK compliance workflow and local harness need to use SDK test harness release 0.8.0, with reusable GitHub workflow calls pinned to the release commit SHA instead of a mutable tag/branch. Running the updated harness exposed SDK/adapter compliance gaps in this repository.
Changes
Tests