Fix unit tests in accordance with changes in solr_interface
@@ -58,33 +58,33 @@ class TestSolrInterface(unittest.TestCase):
"""
A set of test cases for the solr interface module.
"""
- def test_get_index(self):
+ def test_get_index_adapter(self):
appscale_info = flexmock()
appscale_info.should_receive("get_search_location").and_return("somelocation")
solr = solr_interface.Solr()
solr = flexmock(solr)
flexmock(solr_interface)
- solr_interface.should_receive("get_index_name").and_return("index_ns_name")
+ solr_interface.should_receive("get_index_adapter_name").and_return("index_ns_name")
flexmock(urllib2)
urllib2.should_receive("urlopen").and_return(FakeConnection(False))
- self.assertRaises(search_exceptions.InternalError, solr.get_index, "app_id", "ns", "name")
+ self.assertRaises(search_exceptions.InternalError, solr._get_index_adapter, "app_id", "ns", "name")
# Test the case of ValueError on a json.load.
urllib2.should_receive("urlopen").and_return(FakeConnection(True))
flexmock(json)
json.should_receive("load").and_raise(ValueError)
- self.assertRaises(search_exceptions.InternalError, solr.get_index, "app_id", "ns", "name")
+ self.assertRaises(search_exceptions.InternalError, solr._get_index_adapter, "app_id", "ns", "name")
# Test a bad status from SOLR.
dictionary = {'responseHeader':{'status': 1}}
json.should_receive("load").and_return(dictionary)
- self.assertRaises(search_exceptions.InternalError, solr.get_index, "app_id", "ns", "name")
+ self.assertRaises(search_exceptions.InternalError, solr._get_index_adapter, "app_id", "ns", "name")
fields = [{'name':"index_ns_name_"}]
dictionary = {'responseHeader':{'status': 0}, "fields": fields}
json.should_receive("load").and_return(dictionary)
- index = solr.get_index("app_id", "ns", "name")
- self.assertEquals(index.schema.fields[0]['name'], "index_ns_name_")
+ index = solr._get_index_adapter("app_id", "ns", "name")
+ self.assertEquals(index.fields[0]['name'], "index_ns_name_")
def test_update_schema(self):
appscale_info = flexmock()
@@ -146,7 +146,7 @@ class TestSolrInterface(unittest.TestCase):
solr = solr_interface.Solr()
solr = flexmock(solr)
solr.should_receive("to_solr_doc").and_return(FakeSolrDoc())
- solr.should_receive("get_index").and_return(FakeIndex())
+ solr.should_receive("_get_index_adapter").and_return(FakeIndex())
solr.should_receive("compute_updates").and_return([])
solr.should_receive("to_solr_hash_map").and_return(None)
solr.should_receive("commit_update").and_return(None)
