Created
March 4, 2014 03:22
-
-
Save jimmycuadra/9339727 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mock import patch | |
@patch('path.to.module.S3Library') | |
def test_stores_data_in_s3(S3Library): | |
my_method(data) | |
assert S3Library.upload_file.called_once_with(data) | |
@patch('path.to.module.S3Library') | |
def test_data_contains_some_value(S3Library): | |
S3Library.get_file.return_value = _stub_data() | |
xml_file = S3Library.get_file('filename') | |
data = XMLParser.parse(xml_file) | |
assert data.value == 'something' | |
def _stub_data(): | |
return FakeXMLObject() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment