Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaredlockhart/f137fbdc52603c61a44703229dc68f29 to your computer and use it in GitHub Desktop.
Save jaredlockhart/f137fbdc52603c61a44703229dc68f29 to your computer and use it in GitHub Desktop.
MockGithubTestMixin(object)
def setUp(self):
super(MockGithubTestMixin, self).setUp()
mock_github_patcher = mock.patch('scienceapi.utility.github.github')
self.mock_github = mock_github_patcher.start()
self.addCleanup(mock_github_patcher.stop)
mock_contributor = mock.MagicMock()
mock_contributor.login = 'user!'
mock_contributor.html_url = '/user'
mock_contributor.avatar_url = '/image.png'
self.mock_github.get_repo().get_contributors.return_value = [mock_contributor]
def test_somethign_wahtever(self):
class A(object):
def hello(self):
print 'hello!'
class Mixin(object):
def hello(self):
super(Mixin, self).hello()
print 'oops mixin!'
class B(Mixin, A):
def hello(self):
super(B, self).hello()
print 'zomg hello!'
b = B()
b.hello()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment