{"action":"created","comment":{"url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments/49195099","id":49195099,"diff_hunk":"@@ -0,0 +1,101 @@\n+#!/usr/bin/env python\n+# Copyright (c) 2015 IBM. All rights reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\"\"\"\n+result module unit tests\n+\"\"\"\n+import unittest\n+\n+from cloudant.design_document import DesignDocument\n+from cloudant.errors import CloudantArgumentError\n+from cloudant.result import python_to_couch, Result\n+from cloudant.views import View\n+from tests.unit.db.unit_t_db_base import UnitTestDbBase\n+\n+\n+class PythonToCouchTests(unittest.TestCase):\n+    \"\"\"\n+    test cases for validating python_to_couch's options\n+    \"\"\"\n+\n+    def test_valid_option_group_level(self):\n+        \"\"\"\n+        Test group_level option is valid\n+        \"\"\"\n+        opts = {\n+            \"group_level\": 100\n+        }\n+        result = python_to_couch(opts)\n+        self.assertEqual(result['group_level'], 100)\n+\n+    def test_invalid_option_group_level(self):\n+        \"\"\"\n+        Test group_level options are invalid\n+        \"\"\"\n+        opts = {\n+            \"group_level\": True\n+        }\n+        self.assertRaises(CloudantArgumentError, python_to_couch, opts)\n+        opts = {\n+            \"group_level\": \"100\"\n+        }\n+        self.assertRaises(CloudantArgumentError, python_to_couch, opts)\n+\n+\n+class ResultTests(UnitTestDbBase):\n+    \"\"\"\n+    tests for Result class\n+    \"\"\"\n+","path":"tests/unit/db/result_test.py","position":null,"original_position":60,"commit_id":"0614e91213d1a71095c3eb7b423d971a5163e1b0","original_commit_id":"ac2dac2b9e4c4bb01aac1052a4493a1beb6571d0","user":{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},"body":"Fixed in 0614e91.","created_at":"2016-01-08T14:54:03Z","updated_at":"2016-01-08T14:54:03Z","html_url":"https://github.com/cloudant/python-cloudant/pull/83#discussion_r49195099","pull_request_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83","_links":{"self":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments/49195099"},"html":{"href":"https://github.com/cloudant/python-cloudant/pull/83#discussion_r49195099"},"pull_request":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83","id":55370957,"html_url":"https://github.com/cloudant/python-cloudant/pull/83","diff_url":"https://github.com/cloudant/python-cloudant/pull/83.diff","patch_url":"https://github.com/cloudant/python-cloudant/pull/83.patch","issue_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/83","number":83,"state":"open","locked":false,"title":"Fix group_level type to `int` and add new test case class","user":{"login":"emlaver","id":10552966,"avatar_url":"https://avatars.githubusercontent.com/u/10552966?v=3","gravatar_id":"","url":"https://api.github.com/users/emlaver","html_url":"https://github.com/emlaver","followers_url":"https://api.github.com/users/emlaver/followers","following_url":"https://api.github.com/users/emlaver/following{/other_user}","gists_url":"https://api.github.com/users/emlaver/gists{/gist_id}","starred_url":"https://api.github.com/users/emlaver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emlaver/subscriptions","organizations_url":"https://api.github.com/users/emlaver/orgs","repos_url":"https://api.github.com/users/emlaver/repos","events_url":"https://api.github.com/users/emlaver/events{/privacy}","received_events_url":"https://api.github.com/users/emlaver/received_events","type":"User","site_admin":false},"body":"*What*\r\n- The group_level is mis-typed in our result module ARG_TYPES. It should be set to `(int, types.NoneType)` but is currently set to `basestring`. Issue #55.\r\n- Add Result and python_to_couch test cases for option group_level as part of issue #42.\r\n- Boolean values for group_level should throw an exception.\r\n\r\n*How*\r\n- Replace current group_level type `basestring` with `int`\r\n- Throw Cloudant argument exception when a boolean value exists in a python_to_couch option, and the `ARG_TYPES` is expecting '(int, types.NoneType)`.\r\n\r\n*Testing*\r\nAdd new test class that contains Result and python_to_couch testing with group_level option.\r\nFuture tests (#42) will be added for the existing python_to_couch options.\r\n\r\nreviewer: @alfinkel","created_at":"2016-01-07T18:17:41Z","updated_at":"2016-01-08T14:54:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c512810d5a3d6d65b025bc4d773b0e4a05085c3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83/commits","review_comments_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83/comments","review_comment_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/83/comments","statuses_url":"https://api.github.com/repos/cloudant/python-cloudant/statuses/0614e91213d1a71095c3eb7b423d971a5163e1b0","head":{"label":"cloudant:55-change-grouplevel-type","ref":"55-change-grouplevel-type","sha":"0614e91213d1a71095c3eb7b423d971a5163e1b0","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":41557383,"name":"python-cloudant","full_name":"cloudant/python-cloudant","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/python-cloudant","description":"A Python library for Cloudant and CouchDB","fork":false,"url":"https://api.github.com/repos/cloudant/python-cloudant","forks_url":"https://api.github.com/repos/cloudant/python-cloudant/forks","keys_url":"https://api.github.com/repos/cloudant/python-cloudant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/python-cloudant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/python-cloudant/teams","hooks_url":"https://api.github.com/repos/cloudant/python-cloudant/hooks","issue_events_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/python-cloudant/events","assignees_url":"https://api.github.com/repos/cloudant/python-cloudant/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/python-cloudant/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/python-cloudant/tags","blobs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/python-cloudant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/python-cloudant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/python-cloudant/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/python-cloudant/languages","stargazers_url":"https://api.github.com/repos/cloudant/python-cloudant/stargazers","contributors_url":"https://api.github.com/repos/cloudant/python-cloudant/contributors","subscribers_url":"https://api.github.com/repos/cloudant/python-cloudant/subscribers","subscription_url":"https://api.github.com/repos/cloudant/python-cloudant/subscription","commits_url":"https://api.github.com/repos/cloudant/python-cloudant/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/python-cloudant/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/python-cloudant/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/python-cloudant/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/python-cloudant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/python-cloudant/merges","archive_url":"https://api.github.com/repos/cloudant/python-cloudant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/python-cloudant/downloads","issues_url":"https://api.github.com/repos/cloudant/python-cloudant/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/python-cloudant/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/python-cloudant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/python-cloudant/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/python-cloudant/releases{/id}","created_at":"2015-08-28T16:22:49Z","updated_at":"2015-12-14T05:36:25Z","pushed_at":"2016-01-08T14:51:44Z","git_url":"git://github.com/cloudant/python-cloudant.git","ssh_url":"git@github.com:cloudant/python-cloudant.git","clone_url":"https://github.com/cloudant/python-cloudant.git","svn_url":"https://github.com/cloudant/python-cloudant","homepage":null,"size":374,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":31,"forks":2,"open_issues":31,"watchers":11,"default_branch":"master"}},"base":{"label":"cloudant:master","ref":"master","sha":"07bf19cb325a8fb9041f97a8d06e76b213b007eb","user":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"repo":{"id":41557383,"name":"python-cloudant","full_name":"cloudant/python-cloudant","owner":{"login":"cloudant","id":44642,"avatar_url":"https://avatars.githubusercontent.com/u/44642?v=3","gravatar_id":"","url":"https://api.github.com/users/cloudant","html_url":"https://github.com/cloudant","followers_url":"https://api.github.com/users/cloudant/followers","following_url":"https://api.github.com/users/cloudant/following{/other_user}","gists_url":"https://api.github.com/users/cloudant/gists{/gist_id}","starred_url":"https://api.github.com/users/cloudant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloudant/subscriptions","organizations_url":"https://api.github.com/users/cloudant/orgs","repos_url":"https://api.github.com/users/cloudant/repos","events_url":"https://api.github.com/users/cloudant/events{/privacy}","received_events_url":"https://api.github.com/users/cloudant/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cloudant/python-cloudant","description":"A Python library for Cloudant and CouchDB","fork":false,"url":"https://api.github.com/repos/cloudant/python-cloudant","forks_url":"https://api.github.com/repos/cloudant/python-cloudant/forks","keys_url":"https://api.github.com/repos/cloudant/python-cloudant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cloudant/python-cloudant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cloudant/python-cloudant/teams","hooks_url":"https://api.github.com/repos/cloudant/python-cloudant/hooks","issue_events_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/events{/number}","events_url":"https://api.github.com/repos/cloudant/python-cloudant/events","assignees_url":"https://api.github.com/repos/cloudant/python-cloudant/assignees{/user}","branches_url":"https://api.github.com/repos/cloudant/python-cloudant/branches{/branch}","tags_url":"https://api.github.com/repos/cloudant/python-cloudant/tags","blobs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cloudant/python-cloudant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cloudant/python-cloudant/git/refs{/sha}","trees_url":"https://api.github.com/repos/cloudant/python-cloudant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cloudant/python-cloudant/statuses/{sha}","languages_url":"https://api.github.com/repos/cloudant/python-cloudant/languages","stargazers_url":"https://api.github.com/repos/cloudant/python-cloudant/stargazers","contributors_url":"https://api.github.com/repos/cloudant/python-cloudant/contributors","subscribers_url":"https://api.github.com/repos/cloudant/python-cloudant/subscribers","subscription_url":"https://api.github.com/repos/cloudant/python-cloudant/subscription","commits_url":"https://api.github.com/repos/cloudant/python-cloudant/commits{/sha}","git_commits_url":"https://api.github.com/repos/cloudant/python-cloudant/git/commits{/sha}","comments_url":"https://api.github.com/repos/cloudant/python-cloudant/comments{/number}","issue_comment_url":"https://api.github.com/repos/cloudant/python-cloudant/issues/comments{/number}","contents_url":"https://api.github.com/repos/cloudant/python-cloudant/contents/{+path}","compare_url":"https://api.github.com/repos/cloudant/python-cloudant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cloudant/python-cloudant/merges","archive_url":"https://api.github.com/repos/cloudant/python-cloudant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cloudant/python-cloudant/downloads","issues_url":"https://api.github.com/repos/cloudant/python-cloudant/issues{/number}","pulls_url":"https://api.github.com/repos/cloudant/python-cloudant/pulls{/number}","milestones_url":"https://api.github.com/repos/cloudant/python-cloudant/milestones{/number}","notifications_url":"https://api.github.com/repos/cloudant/python-cloudant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cloudant/python-cloudant/labels{/name}","releases_url":"https://api.github.com/repos/cloudant/python-cloudant/releases{/id}","created_at":"2015-08-28T16:22:49Z","updated_at":"2015-12-14T05:36:25Z","pushed_at":"2016-01-08T14:51:44Z","git_url":"git://github.com/cloudant/python-cloudant.git","ssh_url":"git@github.com:cloudant/python-cloudant.git","clone_url":"https://github.com/cloudant/python-cloudant.git","svn_url":"https://github.com/cloudant/python-cloudant","homepage":null,"size":374,"stargazers_count":11,"watchers_count":11,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":31,"forks":2,"open_issues":31,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83"},"html":{"href":"https://github.com/cloudant/python-cloudant/pull/83"},"issue":{"href":"https://api.github.com/repos/cloudant/python-cloudant/issues/83"},"comments":{"href":"https://api.github.com/repos/cloudant/python-cloudant/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cloudant/python-cloudant/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/cloudant/python-cloudant/statuses/0614e91213d1a71095c3eb7b423d971a5163e1b0"}}}}