Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail tests mocking incorrectly #1529

Merged
merged 4 commits into from
Jan 20, 2015

Conversation

mfraezz
Copy link
Member

@mfraezz mfraezz commented Jan 20, 2015

Purpose

See #1363

Changes

Use "mock" library to patch the sending of http requests. Requests that would be sent now generate the exception "UnmockedError"

Side Effects

Previously passing, improperly mocked tests now fail.

@@ -0,0 +1,6 @@
class UnmockedError(Exception):
def __init__(self):
super(Exception, self).__init__(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This signature for __init__ is incorrect; it should include a message parameter. Also, super must be called with the child class, not the parent class.

def __init__(self, message='No mocking exists...'):
    super(UnmockedError, self).__init__(message)

"fail_if_private" was unmocked, sending a request
Mock requesting function "contents()"
Actual request was returning none, but still performing request
@sloria sloria merged commit 8213755 into CenterForOpenScience:develop Jan 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants