This is how mock.patch should be used, but I'm having some problems on my own codebase.
It's weird, but in this tiny example everything works just fine...
This is how mock.patch should be used, but I'm having some problems on my own codebase.
It's weird, but in this tiny example everything works just fine...
import boto.s3.connection | |
creds = {"aws_secret_access_key": "fakes", | |
"aws_access_key_id": "fakes"} | |
class DBConnection(object): | |
def connect(self): | |
return boto.s3.connection.S3Connection(**creds).get_bucket("something") |
boto==2.9.6 | |
mock==1.0.1 | |
nose==1.3.0 |
import db | |
def connect(): | |
return db.DBConnection().connect() |
import service | |
from mock import patch | |
def service_test(): | |
with patch("boto.s3.connection.S3Connection.get_bucket") as c: | |
service.connect() | |
c.assert_called_with("something") |