Esempio n. 1
0
  def test_index_document(self):
    solr_interface = flexmock()
    solr_interface.should_receive("Solr").and_return(FakeSolr())
    solr_interface.should_receive("update_document") 
    fake_response = FakeIndexDocumentResponse()
    flexmock(search_service_pb) 
    search_service_pb.should_receive("IndexDocumentRequest").and_return(FakeIndexDocumentRequest("data"))
    search_service_pb.should_receive("IndexDocumentResponse").and_return(fake_response)
    search_service = search_api.SearchService() 
    search_service = flexmock(search_service)

    self.assertEquals(search_service.index_document("app_data"), ("encoded", 0, ""))
Esempio n. 2
0
  def test_remote_request(self):
    solr_interface = flexmock()
    solr_interface.should_receive("Solr").and_return(FakeSolr())

    flexmock(remote_api_pb) 
    remote_api_pb.should_receive("Request").and_return(FakeRequest())
    remote_api_pb.should_receive("Response").and_return(FakeResponse())
   
    search_service = search_api.SearchService() 
    search_service = flexmock(search_service)
    search_service.should_receive("index_document").and_return("response_data", 0, "").once()

    self.assertEquals(search_service.remote_request("app_data"), "encoded")
Esempio n. 3
0
 def test_unknown_request(self):
   flexmock(solr_interface)
   solr_interface.should_receive("Solr").and_return(FakeSolr())
   search_service = search_api.SearchService() 
   self.assertRaises(NotImplementedError, 
     search_service.unknown_request, "some_unknown_type")