From cb33a80b60b16942132cb356badaf9d18b0ca696 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Mon, 5 Aug 2013 16:39:09 +0200 Subject: ignore update errors when using the update script --- bin/updater.py | 2 +- external/feedapi.php | 8 +++----- tests/unit/external/FeedAPITest.php | 6 ++---- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/bin/updater.py b/bin/updater.py index 9e6d7b5a0..5c83b98b0 100644 --- a/bin/updater.py +++ b/bin/updater.py @@ -132,7 +132,7 @@ def main(): # register user and password for a certain url auth = urllib.request.HTTPPasswordMgrWithDefaultRealm() - auth.add_password(None, args.url, args.user, args.password) + auth.add_password("Authorisation Required", args.url, args.user, args.password) auth_handler = urllib.request.HTTPBasicAuthHandler(auth) opener = urllib.request.build_opener(auth_handler) urllib.request.install_opener(opener) diff --git a/external/feedapi.php b/external/feedapi.php index 8eabd6942..684769c6e 100644 --- a/external/feedapi.php +++ b/external/feedapi.php @@ -213,11 +213,9 @@ class FeedAPI extends Controller { try { $this->feedBusinessLayer->update($feedId, $userId); - return new JSONResponse(); - } catch(BusinessLayerException $ex) { - return new JSONResponse(array('message' => $ex->getMessage()), - Http::STATUS_NOT_FOUND); - } + // ignore update failure (feed could not be reachable etc, we dont care) + } catch(BusinessLayerException $ex) {} + return new JSONResponse(); } diff --git a/tests/unit/external/FeedAPITest.php b/tests/unit/external/FeedAPITest.php index 2963125b2..9a092a84e 100644 --- a/tests/unit/external/FeedAPITest.php +++ b/tests/unit/external/FeedAPITest.php @@ -491,16 +491,14 @@ class FeedAPITest extends ControllerTestUtility { } - public function testUpdateNotFound() { + public function testUpdateError() { $this->feedBusinessLayer->expects($this->once()) ->method('update') ->will($this->throwException(new BusinessLayerException($this->msg))); $response = $this->feedAPI->update(); - $data = $response->getData(); - $this->assertEquals($this->msg, $data['message']); - $this->assertEquals(Http::STATUS_NOT_FOUND, $response->getStatus()); + $this->assertTrue($response instanceof JSONResponse); } -- cgit v1.2.3