Commit graph

66 commits

Author SHA1 Message Date
daniel
a1fb3de7d2 Clear token cache when resetting session.
ApiTestCase resets global session data in setup, invalidating any existing cookies.
ApiQueryInfo caches all tokens, these need to be cleared out so tokens are re-generated
to match the fresh session.

Until now, individual tests have been doing that, but there's no not to do this per
default.

Change-Id: Icefa362190c2e7d87d09bda30079255741824f55
2012-09-24 15:07:36 +02:00
Siebrand Mazeland
59ec5a325c Move api/ApiTestUser.php to TestUser.php and make available in MediaWikiTestCase class.
* Renamed class ApiTestUser to TestUser.

Change-Id: I1c3c659c3ba5c54a314d879132f760008983372d
2012-09-13 18:40:23 +00:00
daniel
78b4f237ef very basic test for ApiEditPage
Based on the generic Api logging system in APITestCase.

Change-Id: I28c0bd41f585cca199fdef9a78e60ef66625d37f
2012-08-27 13:56:52 +02:00
daniel
d9bd44c4eb Fix ApiWatchTest
Based on fixes for session and token handling.

Change-Id: I626855c757b8d2a3ac10f87ff82fedc6c077c99e
2012-06-22 23:57:55 +02:00
daniel
62ac6f3722 Make session persist between calls to doApiRequest
Make sure the global session data in $wgRequest is used for doApiRequest
per default, and return it's content among with the request's results.

Previously, an empty session was used per default, and the local context's
session data would get out of sync with $wgRequest.

This change allows for the following assumptions to hold in test cases:

* within the same function, changes to the session made by one api call
  will be visible to subsequent api calls.

* the session data returned by doApiRequest is the actual status of the
  session as manipulated by the api call. This session data can be passed
  to subsequent api calls.

Note that the session data is still reset for every call to a test
function.

Change-Id: Ia20cf0ccfcdca736dd5da3444b14fbdd1c5def46
2012-06-22 23:22:34 +02:00
daniel
7d3d38748a Fix session handling in API test cases.
* Use the API module's own context to check edit tokens.
* Use the global session if none is provided to doApiRequest.
* Fix ApiFlockTest to not pass an empty session, so the tokens from
  the global request can be used.

Change-Id: I2bff2390f43beb984b1b451bcf4e41271b2f054f
2012-06-21 22:29:19 +02:00
Antoine Musso
fc6bc233be Fix doxygen docs before REL1_19 branching 2012-02-01 20:53:38 +00:00
Ian Baker
77320e1994 changed instances of sample.com to example.com per RFC 2606 2011-12-21 22:22:01 +00:00
Alexandre Emsenhuber
681523d5ad Fix for r100905:
* Make tests work again
* Added ApiTestCase::doApiRequest() and related to pass it to the context and removed override of $wgUser where possible
* Fix ApiLogin to get the correct User object (i.e. the logged in one)
* Fix ApiBase to feed a RequestContext to setContext() so that ApiLogin can call setUser()
2011-10-27 18:46:40 +00:00
John Du Hart
998e7c3a86 Followup r100905, fixed the ApiTests 2011-10-27 01:06:50 +00:00
Chad Horohoe
a1cd4f0478 rvv (r94406) 2011-08-13 14:00:22 +00:00
Chad Horohoe
6a7172fb99 Purposefully break two tests so I can see how Jenkins reacts to it. Will rv immediately 2011-08-13 13:58:46 +00:00
Chad Horohoe
8c5bae9746 Followup r91270: didn't need to be so paranoid about $_SESSION, and actually was causing more issues than it solved. 2011-07-06 16:56:26 +00:00
Chad Horohoe
85a5f0eb85 Merge ApiTestSetup into ApiTestCase and update all subclasses. The amount of duplication here was nasty, and also lets us get rid of a bunch of useless require_once()s.
./phpunit.php --filter Api currently gives me: Tests: 24, Assertions: 107, Incomplete: 1, Skipped: 2.
2011-07-01 16:34:02 +00:00
Platonides
fe7ee51f3c Follow up r87210 2011-05-01 23:02:27 +00:00
Mark A. Hershberger
4e9b2c5c53 Apply modification of mdale's patch from Bug #28420: “Re-factor upload tests to support extensions extending upload test case” 2011-04-06 19:50:54 +00:00