I'm trying to use monkeypatch
to mock one public function but it doesn't seem to work for me.
Here's my test
mp = monkeypatch()
mp.setattr(mrss.version_controller, 'get_version', lambda env: 7)
mrss_feed = get_feed(env=get_config())
And this is my get_feed function
from mrss.version_controller import get_version
def get_feed(env=os.environ):
uploader = Uploader(env=env)
folder = env.get('S3_FOLDER')
version = get_version(env)
print version.isdigit()
print 'version is {v}'.format(v=str(version))
if not version or not version.isdigit():
return ''
And all I got for get_version
is empty string
False
version is
Aucun commentaire:
Enregistrer un commentaire