diff options
| author | Tang Chen <tangchen@cn.fujitsu.com> | 2015-11-14 14:38:12 +0800 |
|---|---|---|
| committer | Tang Chen <tangchen@cn.fujitsu.com> | 2015-11-19 18:23:08 +0800 |
| commit | 20bf1ef6757258619678e5ee00b8a2c6d742e1f1 (patch) | |
| tree | 76a42cb4d2770ef1da547c35add529458426b0d7 /openstackclient/common/utils.py | |
| parent | 5f6f456bfd388c199d837371fe11bb041fa2cfd9 (diff) | |
| download | python-openstackclient-20bf1ef6757258619678e5ee00b8a2c6d742e1f1.tar.gz | |
Enable FakeResource to fake methods.
Use MagicMock to fake a method in FakeResource. A new function:
add_method(name, return_value)
is added to FakeResource. The caller specifies method @name and @return_value,
the function will add an attribute with @name, which is a callable MagicMock
object whose return value is @return_value.
When user access the attribute with a (), @return_value will be returned by
MagicMock, which looks like a function call.
Change-Id: I12eb876cbebab064773df7b5dd612de69bbf3f01
Implements: blueprint osc-unit-test-framework-improvement
Diffstat (limited to 'openstackclient/common/utils.py')
0 files changed, 0 insertions, 0 deletions
