Page MenuHomePhabricator

Write unit tests for new endpoints in the OAuth extension
Closed, ResolvedPublic

Description

Add unit tests to support the functionality added to the OAuth extension for T257982

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 28 2020, 3:21 PM
BPirkle added a subscriber: BPirkle.Aug 5 2020, 3:56 PM

General rule: our unit tests should test contracts, not implementations. In other words, test what the class/interface/handler is supposed to do, rather than using special knowledge about how it accomplishes it. (Note: testing failures is fine, failing according to contract is super important)

From T257982, the functionality added was:

  • List their clients and view client details
  • Create a client (T251280)
  • Reset client secret (T254200)

Each of these is an endpoint in experimentalRoutes.json. I suggest writing a test for each of these endpoints, using the same pattern as the existing AccessTokenEndpointTest and AuthorizationEndpointTest. You can use a @covers tag to indicate that the test covers the related handler class.

Change 618828 had a related patch set uploaded (by Art.tsymbar; owner: arttsymbar):
[mediawiki/extensions/OAuth@master] OAuth: Unit tests for new endpoints

https://gerrit.wikimedia.org/r/618828

Change 624690 had a related patch set uploaded (by Art.tsymbar; owner: arttsymbar):
[mediawiki/extensions/OAuth@master] Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth into review/art_tsymbar/T259043-unit-tests-for-new-endpoints-in-OAuth-ext Change-Id: Iaa1bdf59a6a7d17f2f277f873456da9f1b7b8dda

https://gerrit.wikimedia.org/r/624690

Change 624690 abandoned by Art.tsymbar:
[mediawiki/extensions/OAuth@master] Merge branch 'master' of ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth into review/art_tsymbar/T259043-unit-tests-for-new-endpoints-in-OAuth-ext Change-Id: Iaa1bdf59a6a7d17f2f277f873456da9f1b7b8dda

Reason:

https://gerrit.wikimedia.org/r/624690

Change 624729 had a related patch set uploaded (by Art.tsymbar; owner: arttsymbar):
[mediawiki/extensions/OAuth@master] OAuth: Unit tests for new endpoints

https://gerrit.wikimedia.org/r/624729

Change 618828 abandoned by Ppchelko:
[mediawiki/extensions/OAuth@master] OAuth: Unit tests for new endpoints

Reason:
Ic7f8fca6b2be25a0ec0bc8ed68c0b5fae457f442

https://gerrit.wikimedia.org/r/618828

Change 624729 merged by jenkins-bot:
[mediawiki/extensions/OAuth@master] OAuth: Unit tests for new endpoints

https://gerrit.wikimedia.org/r/624729

apaskulin closed this task as Resolved.Sep 8 2020, 2:25 PM

Thanks, Art!