2
我想为下面的类写一个单元测试。从蟒蛇嘲讽模块
import boto
class ToBeTested:
def location(self, eb):
return eb.create_storage_location()
def some_method(self):
eb = boto.beanstalk.connect_to_region(region, access_key, secret_key)
location(eb)
有没有办法来嘲笑boto.beanstalk.connect_to_region返回值和最终嘲讽create_storage_location?我是新来的补丁和蟒蛇模拟,所以我不知道我怎么能做到这一点。有人能让我知道是否有办法做到这一点?
非常感谢!
谢谢,Alecxe!正是我在找什么。 – test123
[moto项目](https://github.com/spulec/moto)也可能对你感兴趣。 – garnaat