cloudant / python-cloudant

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

Fixing test_update_field_success_on_retry #432

Closed aogier closed 5 years ago

aogier commented 5 years ago

Checklist

Description

Fixed a document test mock Fixes #431

Approach

Reimplemented a mock so doc.save() gets called during update_field and not mock construction/evaluation. Tests were passing because update_field did not called save() at all, thus making it difficult to spot.

Schema & API Changes

Security and Privacy

Testing

Monitoring and Logging

smithsz commented 5 years ago

I'm +1. I think it's pretty clear what that new side_effect def is doing.

The only other thing I can think of doing it mocking the second save with mock.DEFAULT and just asserting there were two calls to .save().

@emlaver what do you reckon?