Captricity / mocurly

Mocurly is a library that mocks the recurly python client
MIT License
8 stars 6 forks source link

Decorator on class methods not working #4

Closed niekbaeten closed 8 years ago

niekbaeten commented 8 years ago

First, thanks for your work on this project it has been really helpful.

The mocurly decorator doesn't seem to work on class methods:

class RecurlyTestCase(unittest.TestCase):
  @mocurly
  def test_count_recurly_accounts(self):
    for i in range(10):
        recurly.Account(account_code=str(i)).save()
    assert count_recurly_accounts() == 10

raises the following exception:

    def __call__(self, *args, **kwargs):
        self.start()
        try:
>           retval = self.func(*args, **kwargs)
E           TypeError: test_count_recurly_accounts() takes exactly 1 argument (0 given)

I would have made a pull request, but I'm not sure how to fix this.

yorinasub17 commented 8 years ago

Thanks for the report! You can try out https://github.com/Captricity/mocurly/pull/5

niekbaeten commented 8 years ago

Yes that works, thanks for the quick fix!