Skip to content

Commit

Permalink
[SD-5344] Extend test function to include Ingest documents
Browse files Browse the repository at this point in the history
  • Loading branch information
marwoodandrew authored and petrjasek committed Sep 13, 2016
1 parent 94a405a commit 288ba23
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/content_filters/content_filter/content_filter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ def create(self, docs, **kwargs):
article_id = doc.get('article_id')
article = get_resource_service('archive').find_one(req=None, _id=article_id)
if not article:
raise SuperdeskApiError.badRequestError('Article not found!')
article = get_resource_service('ingest').find_one(req=None, _id=article_id)
if not article:
raise SuperdeskApiError.badRequestError('Article not found!')
try:
doc['match_results'] = service.does_match(content_filter, article)
except Exception as ex:
Expand Down
29 changes: 29 additions & 0 deletions features/content_filter_tests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,32 @@ Feature: Content Filter Tests
"match_results": false
}
"""

@auth
@vocabulary
Scenario: Test single article from ingest
Given "ingest"
"""
[{"guid": 1, "_id": 1, "urgency": 1}]
"""
Given empty "filter_conditions"
When we post to "/filter_conditions" with success
"""
[{"name": "sport", "field": "urgency", "operator": "in", "value": "1,2,3"}]
"""
Then we get latest
Given empty "content_filters"
When we post to "/content_filters" with success
"""
[{"content_filter": [{"expression": {"fc": ["#filter_conditions._id#"]}}], "name": "soccer-only"}]
"""
When we post to "/content_filters/test"
"""
[{"filter_id": "#content_filters._id#", "article_id":"1"}]
"""
Then we get existing resource
"""
{
"match_results": true
}
"""

0 comments on commit 288ba23

Please sign in to comment.