couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject [22/26] couchdb-mango git commit: Use config:get_integer
Date Thu, 10 Sep 2015 00:34:24 GMT
Use config:get_integer

COUCHDB-2787


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mango/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mango/commit/928d76ac
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mango/tree/928d76ac
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mango/diff/928d76ac

Branch: refs/heads/master
Commit: 928d76ac2c2739a25313e281cfeb1ac485070054
Parents: 874e8d2
Author: Tony Sun <tony.sun@cloudant.com>
Authored: Thu Sep 3 15:26:27 2015 -0700
Committer: Tony Sun <tony.sun@cloudant.com>
Committed: Thu Sep 3 15:26:27 2015 -0700

----------------------------------------------------------------------
 src/mango_cursor_text.erl              |  2 +-
 test/01-index-crud-test.py             |  8 +++---
 test/04-key-tests.py                   |  2 +-
 test/05-index-selection-test.py        |  4 +--
 test/06-basic-text-test.py             | 38 ++++++++++++++---------------
 test/06-text-default-field-test.py     | 18 +++++++-------
 test/07-text-custom-field-list-test.py |  6 ++---
 test/08-text-limit-test.py             |  6 ++---
 test/09-text-sort-test.py              |  6 ++---
 test/mango.py                          |  3 +--
 10 files changed, 46 insertions(+), 47 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/src/mango_cursor_text.erl
----------------------------------------------------------------------
diff --git a/src/mango_cursor_text.erl b/src/mango_cursor_text.erl
index ec83240..971d153 100644
--- a/src/mango_cursor_text.erl
+++ b/src/mango_cursor_text.erl
@@ -284,7 +284,7 @@ get_limit(CAcc) ->
 
 
 get_dreyfus_limit() ->
-    list_to_integer(config:get("dreyfus", "max_limit", "200")).
+    config:get_integer("dreyfus", "max_limit", 200).
 
 
 get_json_docs(DbName, Hits) ->

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/01-index-crud-test.py
----------------------------------------------------------------------
diff --git a/test/01-index-crud-test.py b/test/01-index-crud-test.py
index 021d66e..2852a6a 100644
--- a/test/01-index-crud-test.py
+++ b/test/01-index-crud-test.py
@@ -16,10 +16,10 @@ import mango
 import unittest
 
 class IndexCrudTests(mango.DbPerClass):
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
-        super(KeyTests, klass).setUpClass()
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
+    #     super(KeyTests, klass).setUpClass()
 
     def test_bad_fields(self):
         bad_fields = [

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/04-key-tests.py
----------------------------------------------------------------------
diff --git a/test/04-key-tests.py b/test/04-key-tests.py
index 5174d0b..9b55c7f 100644
--- a/test/04-key-tests.py
+++ b/test/04-key-tests.py
@@ -56,7 +56,7 @@ TEST_DOCS = [
 class KeyTests(mango.DbPerClass):
     @classmethod
     def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+        # raise unittest.SkipTest('text index service not available')
         super(KeyTests, klass).setUpClass()
         klass.db.save_docs(TEST_DOCS, w=3)
         klass.db.create_index(["type"], ddoc="view")

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/05-index-selection-test.py
----------------------------------------------------------------------
diff --git a/test/05-index-selection-test.py b/test/05-index-selection-test.py
index 4ded668..375085f 100644
--- a/test/05-index-selection-test.py
+++ b/test/05-index-selection-test.py
@@ -19,7 +19,7 @@ class IndexSelectionTests(mango.UserDocsTests):
     @classmethod
     def setUpClass(klass):
         super(IndexSelectionTests, klass).setUpClass()
-        # user_docs.add_text_indexes(klass.db, {})
+        user_docs.add_text_indexes(klass.db, {})
 
     def test_basic(self):
         resp = self.db.find({"name.last": "A last name"}, explain=True)
@@ -77,7 +77,7 @@ class IndexSelectionTests(mango.UserDocsTests):
 class MultiTextIndexSelectionTests(mango.UserDocsTests):
     @classmethod
     def setUpClass(klass):
-        raise unittest.SkipTest('text index service is not available')
+        # raise unittest.SkipTest('text index service is not available')
         super(MultiTextIndexSelectionTests, klass).setUpClass()
         klass.db.create_text_index(ddoc="foo", analyzer="keyword")
         klass.db.create_text_index(ddoc="bar", analyzer="email")

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/06-basic-text-test.py
----------------------------------------------------------------------
diff --git a/test/06-basic-text-test.py b/test/06-basic-text-test.py
index 72a3918..593e6d7 100644
--- a/test/06-basic-text-test.py
+++ b/test/06-basic-text-test.py
@@ -17,24 +17,24 @@ import user_docs
 import num_string_docs
 
 
-class TextIndexCheckTests(mango.DbPerClass):
+# class TextIndexCheckTests(mango.DbPerClass):
 
-    def test_create_text_index(self):
-        body = json.dumps({
-            'index': {
-                'fields': 'test'
-            },
-            'type': 'text'
-        })
-        resp = self.db.sess.post(self.db.path("_index"), data=body)
-        assert resp.status_code == 503, resp
+#     def test_create_text_index(self):
+#         body = json.dumps({
+#             'index': {
+#                 'fields': 'test'
+#             },
+#             'type': 'text'
+#         })
+#         resp = self.db.sess.post(self.db.path("_index"), data=body)
+#         assert resp.status_code == 503, resp
 
 
 class BasicTextTests(mango.UserDocsTextTests):
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
 
     def test_simple(self):
         docs = self.db.find({"$text": "Stephanie"})
@@ -431,9 +431,9 @@ class BasicTextTests(mango.UserDocsTextTests):
 
 class ElemMatchTests(mango.FriendDocsTextTests):
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
 
     def test_elem_match_non_object(self):
         q = {"bestfriends":{
@@ -566,9 +566,9 @@ class ElemMatchTests(mango.FriendDocsTextTests):
 # Test numeric strings for $text
 class NumStringTests(mango.NumStringDocsTextTests):
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
 
     def test_floating_point_val(self):
         float_point_string = num_string_docs.DOCS[2]["number_string"]

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/06-text-default-field-test.py
----------------------------------------------------------------------
diff --git a/test/06-text-default-field-test.py b/test/06-text-default-field-test.py
index f4aaf9a..599cad6 100644
--- a/test/06-text-default-field-test.py
+++ b/test/06-text-default-field-test.py
@@ -18,9 +18,9 @@ class NoDefaultFieldTest(mango.UserDocsTextTests):
 
     DEFAULT_FIELD = False
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
 
     def test_basic(self):
         docs = self.db.find({"$text": "Ramona"})
@@ -40,9 +40,9 @@ class NoDefaultFieldWithAnalyzer(mango.UserDocsTextTests):
         "analyzer": "keyword"
     }
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text not supported')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text not supported')
 
     def test_basic(self):
         docs = self.db.find({"$text": "Ramona"})
@@ -61,9 +61,9 @@ class DefaultFieldWithCustomAnalyzer(mango.UserDocsTextTests):
         "analyzer": "keyword"
     }
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text not supported')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text not supported')
 
     def test_basic(self):
         docs = self.db.find({"$text": "Ramona"})

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/07-text-custom-field-list-test.py
----------------------------------------------------------------------
diff --git a/test/07-text-custom-field-list-test.py b/test/07-text-custom-field-list-test.py
index 8d68a1f..c59c3a2 100644
--- a/test/07-text-custom-field-list-test.py
+++ b/test/07-text-custom-field-list-test.py
@@ -16,9 +16,9 @@ import unittest
 
 class CustomFieldsTest(mango.UserDocsTextTests):
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
 
     FIELDS = [
         {"name": "favorites.[]", "type": "string"},

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/08-text-limit-test.py
----------------------------------------------------------------------
diff --git a/test/08-text-limit-test.py b/test/08-text-limit-test.py
index 36bf4a9..31083ae 100644
--- a/test/08-text-limit-test.py
+++ b/test/08-text-limit-test.py
@@ -16,9 +16,9 @@ import unittest
 
 class LimitTests(mango.LimitDocsTextTests):
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service not available')
 
     def test_limit_field(self):
         q = {"$or": [{"user_id" : {"$lt" : 10}}, {"filtered_array.[]": 1}]}

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/09-text-sort-test.py
----------------------------------------------------------------------
diff --git a/test/09-text-sort-test.py b/test/09-text-sort-test.py
index 7bdf54a..c06c680 100644
--- a/test/09-text-sort-test.py
+++ b/test/09-text-sort-test.py
@@ -15,9 +15,9 @@ import unittest
 
 class SortTests(mango.UserDocsTextTests):
 
-    @classmethod
-    def setUpClass(klass):
-        raise unittest.SkipTest('text index service is not available')
+    # @classmethod
+    # def setUpClass(klass):
+    #     raise unittest.SkipTest('text index service is not available')
 
     def test_number_sort(self):
         q = {"age": {"$gt": 0}}

http://git-wip-us.apache.org/repos/asf/couchdb-mango/blob/928d76ac/test/mango.py
----------------------------------------------------------------------
diff --git a/test/mango.py b/test/mango.py
index 6764ed5..3464b14 100644
--- a/test/mango.py
+++ b/test/mango.py
@@ -33,8 +33,7 @@ class Database(object):
         self.port = port
         self.dbname = dbname
         self.sess = requests.session()
-        if auth is not None:
-            self.sess.auth = auth
+        self.sess.auth = ('adm', 'pass')
         self.sess.headers["Content-Type"] = "application/json"
 
     @property


Mime
View raw message