-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #927 from marwoodandrew/SDAAP-111
SDAAP-111 Remove DC5 dependency
- Loading branch information
Showing
2 changed files
with
1 addition
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,14 +13,11 @@ | |
from unittests import AAPTestCase | ||
from .fulfill_image_assignments import FullfillImageAssignments | ||
from superdesk.utc import utcnow | ||
from httmock import urlmatch, HTTMock | ||
from eve_elastic.elastic import ElasticCursor | ||
import os | ||
|
||
|
||
class FullfillImageAssignmentsTest(AAPTestCase): | ||
def setUp(self): | ||
self.setupMock(self) | ||
self.app.data.insert('assignments', [ | ||
{ | ||
"_id": ObjectId("5e1692406bb0d58d639f6996"), | ||
|
@@ -70,22 +67,9 @@ def setUp(self): | |
'email': '[email protected]', | ||
'byline': 'User 1' | ||
}]) | ||
self.app.config['DC_URL'] = 'http://a.b.c/rest/aap' | ||
|
||
self.script = FullfillImageAssignments() | ||
|
||
def setupMock(self, context): | ||
context.mock = HTTMock(*[self.mock_dc]) | ||
context.mock.__enter__() | ||
|
||
@urlmatch(scheme='http', netloc='a.b.c', path='/rest/aap/archives/imagearc') | ||
def mock_dc(self, url, request): | ||
dirname = os.path.dirname(os.path.realpath(__file__)) | ||
fixture = os.path.normpath(os.path.join(dirname, '../tests/io/fixtures', 'dc_response.xml')) | ||
with open(fixture, 'r') as f: | ||
xml_raw = f.read() | ||
return {'status_code': 200, 'content': xml_raw} | ||
|
||
def mock_find(resource, req, lookup, p): | ||
doc = {'fetch_endpoint': 'search_providers_proxy', 'pubstatus': 'usable', 'slugline': 'Fish on a bike', | ||
'byline': 'Fred Smith/AAP PHOTOS', '_id': '20200108001362610429', | ||
|