Replace mocked_function.called_with() with mocked_function.assert_called_with()
Bug #2007276 reported by
Corey Bryant
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Cinder Charm |
Confirmed
|
Undecided
|
Trent Lloyd | ||
OpenStack Keystone Charm |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Before mock v5, if you mock something, you can call any random function on it, and it just does nothing.
A common mistake is thus, to call mocked_
mocked_
It doesn't error, as it just makes a mock call to 'called_with' but it doesn't actually test the assertion.
In mock v5 from pypi they added some code to catch that common mistake and error out.
Thank you to Trent Lloyd for the above details and pointing this out.
To post a comment you must log in.
Examples:
charm-cinder: /review. opendev. org/c/openstack /charm- cinder/ +/871677
https:/
charm-keystone: /openstack- ci-reports. ubuntu. com/artifacts/ e7c/870345/ 1/check/ tox-py38/ e7c9db2/ job-output. txt
https:/
Applies to multiple methods not just called_with, e.g. keystone hits it on:
called_once
called_with
has_calls