summaryrefslogtreecommitdiff
path: root/src/mango/test/01-index-crud-test.py
diff options
context:
space:
mode:
authorJoan Touzet <wohali@users.noreply.github.com>2018-11-07 21:40:44 -0500
committerGitHub <noreply@github.com>2018-11-07 21:40:44 -0500
commitcd2b130674856caa6ce725ccfca539202fae8cc2 (patch)
tree77db6b998be4ee6c89aa1c906f90d4a21e8f16c7 /src/mango/test/01-index-crud-test.py
parent2f0ad1b0ce07ad27becdfada74b03b2b14a686a3 (diff)
parentc157c968b349112c5b3e69a3ded7aca7996e761d (diff)
downloadcouchdb-elixir-suite.tar.gz
Merge branch 'master' into elixir-suiteelixir-suite
Diffstat (limited to 'src/mango/test/01-index-crud-test.py')
-rw-r--r--src/mango/test/01-index-crud-test.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/mango/test/01-index-crud-test.py b/src/mango/test/01-index-crud-test.py
index cf5b91865..f57db39af 100644
--- a/src/mango/test/01-index-crud-test.py
+++ b/src/mango/test/01-index-crud-test.py
@@ -13,8 +13,24 @@
import random
import mango
+import copy
import unittest
+DOCS = [
+ {
+ "_id": "1",
+ "name": "Jimi",
+ "age": 10,
+ "cars": 1
+ },
+ {
+ "_id": "2",
+ "name": "kate",
+ "age": 8,
+ "cars": 0
+ }
+]
+
class IndexCrudTests(mango.DbPerClass):
def setUp(self):
self.db.recreate()
@@ -271,6 +287,25 @@ class IndexCrudTests(mango.DbPerClass):
except Exception as e:
self.assertEqual(e.response.status_code, 500)
+ def test_out_of_sync(self):
+ self.db.save_docs(copy.deepcopy(DOCS))
+ self.db.create_index(["age"], name="age")
+
+ selector = {
+ "age": {
+ "$gt": 0
+ },
+ }
+ docs = self.db.find(selector,
+ use_index="_design/a017b603a47036005de93034ff689bbbb6a873c4")
+ self.assertEqual(len(docs), 2)
+
+ self.db.delete_doc("1")
+
+ docs1 = self.db.find(selector, update="False",
+ use_index="_design/a017b603a47036005de93034ff689bbbb6a873c4")
+ self.assertEqual(len(docs1), 1)
+
@unittest.skipUnless(mango.has_text_service(), "requires text service")
class IndexCrudTextTests(mango.DbPerClass):