Commits

Simon Cross committed b2da0c5

Enable search on buckets during tests and add some missing yields to solr tests.

  • Participants
  • Parent commits 02ee0fe

Comments (0)

Files changed (1)

File txriak/tests.py

         self.client = riak.RiakClient(client_id=RIAK_CLIENT_ID)
         self.bucket_name = BUCKET_PREFIX + self.id().rsplit('.', 1)[-1]
         self.bucket = self.client.bucket(self.bucket_name)
+        yield self.bucket.enable_search()
         yield self.bucket.purge_keys()
 
     @defer.inlineCallbacks
     def tearDown(self):
+        yield self.bucket.disable_search()
         yield self.bucket.purge_keys()
 
     @defer.inlineCallbacks
 
     @defer.inlineCallbacks
     def test_solr_search_from_bucket(self):
-        self.bucket.new("user", {"username": "roidrage"}).store()
+        yield 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()
+        yield self.bucket.new("user", {"username": "roidrage"}).store()
         results = yield self.bucket.search("username:roidrage", wt="xml")
         result = results.find("result")
         if not hasattr(result, "iter"):
 
     @defer.inlineCallbacks
     def test_solr_search_with_params(self):
-        self.bucket.new("user", {"username": "roidrage"}).store()
+        yield self.bucket.new("user", {"username": "roidrage"}).store()
         results = yield self.client.solr().search(self.bucket_name,
                                                   "username:roidrage",
                                                   wt="xml")
 
     @defer.inlineCallbacks
     def test_solr_search(self):
-        yield self.bucket.enable_search()
-        self.bucket.new("user", {"username": "roidrage"}).store()
+        yield 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