cloudant / python-cloudant

A Python library for Cloudant and CouchDB
Apache License 2.0
163 stars 55 forks source link

Fixed the bug where design doc was created in CouchDB 3.0 with partition enabled even when the partition flag was false #467

Closed CodipherX closed 4 years ago

CodipherX commented 4 years ago

Checklist

Description

In CouchDB 3.0.0, when attempting to create a design document with partitioned=false, the cloudant still creates the design doc with partitioned=true Fixes #466

Approach

In the src/cloudant/design_document.py, in the __init__ function, the partition options were being set only whenpartition=true. I added an else clause to set partition option when partition flag is false.

Schema & API Changes

No change

Security and Privacy

No change

Testing

Old commit

Modified existing test design_document_tests.py because it already contains relevant tests for unit testing. Added the new test function test_correct_design_document_partitioned_true and test_correct_design_document_partitioned_false

Latest commit

Modified existing test database_partition_tests.py because it already contains the test for partitioned design doc (test_create_partitioned_design_document). Added the new test function for non-partitioned design doc test_create_non_partitioned_design_document . Reversed the changes in design_document_tests.py made in old commit. Also updated design_document_tests.py and database_tests.py for checking partition value while validation

Monitoring and Logging

No change

CodipherX commented 4 years ago

@emlaver I checked the Travis logs and looks like the tests are failing because of the newly added default "options" for partition=false is not taken into account into those failing tests.. I will fix the conflicting unit tests as well

emlaver commented 4 years ago

@CodipherX Thanks for your hard work! I'll squash and merge this