@@ 234-246 (lines=13) @@ | ||
231 | /** |
|
232 | * Testing the `connection/reconnect` endpoint, successful partial reconnect (blog token). |
|
233 | */ |
|
234 | public function test_connection_reconnect_partial_blog_token_success() { |
|
235 | $this->setup_reconnect_test( 'blog_token' ); |
|
236 | add_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request' ), 10, 3 ); |
|
237 | ||
238 | $response = $this->server->dispatch( $this->build_reconnect_request() ); |
|
239 | $data = $response->get_data(); |
|
240 | ||
241 | remove_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request' ), 10 ); |
|
242 | $this->shutdown_reconnect_test( 'blog_token' ); |
|
243 | ||
244 | $this->assertEquals( 200, $response->get_status() ); |
|
245 | $this->assertEquals( 'completed', $data['status'] ); |
|
246 | } |
|
247 | ||
248 | /** |
|
249 | * Testing the `connection/reconnect` endpoint, failed partial reconnect (blog token). |
|
@@ 251-263 (lines=13) @@ | ||
248 | /** |
|
249 | * Testing the `connection/reconnect` endpoint, failed partial reconnect (blog token). |
|
250 | */ |
|
251 | public function test_connection_reconnect_partial_blog_token_fail() { |
|
252 | $this->setup_reconnect_test( 'blog_token' ); |
|
253 | add_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request_fail' ), 10, 3 ); |
|
254 | ||
255 | $response = $this->server->dispatch( $this->build_reconnect_request() ); |
|
256 | $data = $response->get_data(); |
|
257 | ||
258 | remove_filter( 'pre_http_request', array( $this, 'intercept_refresh_blog_token_request_fail' ), 10 ); |
|
259 | $this->shutdown_reconnect_test( 'blog_token' ); |
|
260 | ||
261 | $this->assertEquals( 500, $response->get_status() ); |
|
262 | $this->assertEquals( 'jetpack_secret', $data['code'] ); |
|
263 | } |
|
264 | ||
265 | /** |
|
266 | * Testing the `connection/reconnect` endpoint, successful partial reconnect (user token). |