Commits

Simon Cross committed 02ee0fe

Add missing inlineCallbacks (eep) and missing test for search enable/disable/search_enabled bucket methods.

Comments (0)

Files changed (1)

         self.assertTrue(metas[mk1_lc] == meta_data)
         log.msg('done meta_data_simple')
 
+    @defer.inlineCallbacks
+    def test_search_enable_disable(self):
+        yield self.bucket.disable_search()
+        self.assertEqual((yield self.bucket.search_enabled()), False)
+        yield self.bucket.enable_search()
+        self.assertEqual((yield self.bucket.search_enabled()), True)
+        yield self.bucket.disable_search()
+        self.assertEqual((yield self.bucket.search_enabled()), False)
+
+    @defer.inlineCallbacks
     def test_solr_search_from_bucket(self):
         self.bucket.new("user", {"username": "roidrage"}).store()
         results = yield self.bucket.search("username:roidrage")
         self.assertEquals(1, len(results["response"]["docs"]))
 
+    @defer.inlineCallbacks
     def test_solr_search_with_params_from_bucket(self):
         self.bucket.new("user", {"username": "roidrage"}).store()
         results = yield self.bucket.search("username:roidrage", wt="xml")
             setattr(result, "iter", result.getiterator)
         self.assertEquals(1, len(list(result.iter("doc"))))
 
+    @defer.inlineCallbacks
     def test_solr_search_with_params(self):
         self.bucket.new("user", {"username": "roidrage"}).store()
         results = yield self.client.solr().search(self.bucket_name,
             setattr(result, "iter", result.getiterator)
         self.assertEquals(1, len(list(result.iter("doc"))))
 
+    @defer.inlineCallbacks
     def test_solr_search(self):
+        yield self.bucket.enable_search()
         self.bucket.new("user", {"username": "roidrage"}).store()
         results = yield self.client.solr().search(self.bucket_name,
                                                   "username:roidrage")
+        print results
         self.assertEquals(1, len(results["response"]["docs"]))
 
+    @defer.inlineCallbacks
     def test_add_document_to_index(self):
         yield self.client.solr().add(self.bucket_name,
                                      {"id": "doc", "username": "tony"})
         self.assertEquals("tony",
                           results["response"]["docs"][0]["fields"]["username"])
 
+    @defer.inlineCallbacks
     def test_add_multiple_documents_to_index(self):
         yield self.client.solr().add(self.bucket_name,
                                      {"id": "dizzy", "username": "dizzy"},
                                                   " username:dizzy")
         self.assertEquals(2, len(results["response"]["docs"]))
 
+    @defer.inlineCallbacks
     def test_delete_documents_from_search_by_id(self):
         yield self.client.solr().add(self.bucket_name,
                                      {"id": "dizzy", "username": "dizzy"},
                                                   " username:dizzy")
         self.assertEquals(1, len(results["response"]["docs"]))
 
+    @defer.inlineCallbacks
     def test_delete_documents_from_search_by_query(self):
         yield self.client.solr().add(self.bucket_name,
                                      {"id": "dizzy", "username": "dizzy"},
                                                   " username:dizzy")
         self.assertEquals(0, len(results["response"]["docs"]))
 
+    @defer.inlineCallbacks
     def test_delete_documents_from_search_by_query_and_id(self):
         yield self.client.solr().add(self.bucket_name,
                                      {"id": "dizzy", "username": "dizzy"},