jenkins-bot has submitted this change and it was merged.

Change subject: Add wiki search to revert regression
......................................................................


Add wiki search to revert regression

Internally, it still uses the morelike search
Also add a test to ensure CORS header is present

Bug: T147621
Bug: T147835
Change-Id: Icd784d9f47a330be9bf974a522668a3d574f8135
---
M recommendation/api/api.py
M recommendation/api/swagger.yml
M recommendation/api/test/test_api.py
3 files changed, 9 insertions(+), 0 deletions(-)

Approvals:
  jenkins-bot: Verified
  Nschaaf: Looks good to me, approved



diff --git a/recommendation/api/api.py b/recommendation/api/api.py
index affb160..77330b2 100644
--- a/recommendation/api/api.py
+++ b/recommendation/api/api.py
@@ -52,6 +52,7 @@
 
 finder_map = {
     'morelike': candidate_finders.MorelikeCandidateFinder(),
+    'wiki': candidate_finders.MorelikeCandidateFinder(),
     'mostpopular': candidate_finders.PageviewCandidateFinder(),
 }
 
diff --git a/recommendation/api/swagger.yml b/recommendation/api/swagger.yml
index 67960dc..4f90111 100644
--- a/recommendation/api/swagger.yml
+++ b/recommendation/api/swagger.yml
@@ -78,6 +78,7 @@
     type: string
     enum:
       - morelike
+      - wiki
     default: morelike
 
 paths:
diff --git a/recommendation/api/test/test_api.py 
b/recommendation/api/test/test_api.py
index fa88475..d380365 100644
--- a/recommendation/api/test/test_api.py
+++ b/recommendation/api/test/test_api.py
@@ -43,6 +43,7 @@
     get_query_string(dict(s='xx', t='yy', article='')),
     get_query_string(dict(s='xx', t='yy', pageviews='false')),
     get_query_string(dict(s='xx', t='yy', search='morelike')),
+    get_query_string(dict(s='xx', t='yy', search='wiki')),
 ])
 @pytest.mark.usefixtures('recommend_response')
 def test_good_arg_parsing(client, url):
@@ -122,3 +123,9 @@
     monkeypatch.setattr(filters, 'apply_filters', lambda source, target, recs, 
count: recs)
     result = client.get(get_query_string(dict(s='xx', t='yy', 
pageviews=False)))
     assert GOOD_RESPONSE == json.loads(result.data.decode('utf-8'))
+
+
+@pytest.mark.usefixtures('recommend_response')
+def test_cors_is_present(client):
+    result = client.get(get_query_string(dict(s='xx', t='yy')))
+    assert '*' == result.headers.get('Access-Control-Allow-Origin')

-- 
To view, visit https://gerrit.wikimedia.org/r/315225
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icd784d9f47a330be9bf974a522668a3d574f8135
Gerrit-PatchSet: 1
Gerrit-Project: research/recommendation-api
Gerrit-Branch: master
Gerrit-Owner: Nschaaf <nsch...@wikimedia.org>
Gerrit-Reviewer: Nschaaf <nsch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to