Skip to content

Commit

Permalink
Resolve bug and test due to solr format update. (#2955)
Browse files Browse the repository at this point in the history
* Resolve bug and test due to solr format update.

* Fix unit test due to formatting.
  • Loading branch information
jkmarx committed Aug 28, 2018
1 parent 5c2e970 commit f6b5665
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
12 changes: 8 additions & 4 deletions refinery/data_set_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1187,10 +1187,14 @@ def test__create_solr_params_from_node_uuids(self):
self.assertEqual(
node_solr_params,
{
"q": "django_ct:data_set_manager.node",
"wt": "json",
"fq": "uuid:({})".format(" OR ".join(fake_node_uuids)),
"rows": constants.REFINERY_SOLR_DOC_LIMIT
"json": {
"query": "django_ct:data_set_manager.node",
"filter": "uuid:({})".format(" OR ".join(fake_node_uuids))
},
"params": {
"wt": "json",
"rows": constants.REFINERY_SOLR_DOC_LIMIT
}
}
)

Expand Down
14 changes: 9 additions & 5 deletions refinery/data_set_manager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1156,11 +1156,15 @@ def _create_solr_params_from_node_uuids(node_uuids):
for the information of many Nodes
"""
return {
"q": "django_ct:data_set_manager.node",
"wt": "json",
"fq": "uuid:({})".format(" OR ".join(node_uuids)),
"rows": constants.REFINERY_SOLR_DOC_LIMIT
}
'json': {
"query": "django_ct:data_set_manager.node",
"filter": "uuid:({})".format(" OR ".join(node_uuids)),
},
'params': {
"wt": "json",
"rows": constants.REFINERY_SOLR_DOC_LIMIT
}
}


def get_solr_response_json(node_uuids):
Expand Down
5 changes: 4 additions & 1 deletion refinery/tool_manager/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,15 @@ def tearDown(self):

def create_solr_mock_response(self, nodes):
node_uuids = [n.uuid for n in nodes]
solr_params = _create_solr_params_from_node_uuids(node_uuids)
solr_params['json']['fields'] = solr_params['json']['filter']
solr_params['json'] = json.dumps(solr_params['json'])
return json.dumps(
{
"responseHeader": {
"status": 0,
"QTime": 36,
"params": _create_solr_params_from_node_uuids(node_uuids)
"params": solr_params
},
"response": {
"numFound": len(node_uuids),
Expand Down

0 comments on commit f6b5665

Please sign in to comment.