I have the following code in module a:
class MyManager(models.Manager):
def dowork(self, value1, value2):
print value1, value2
In module b:
class MyModel(models.Model):
objects = MyManager()
value1 = ...
value2 = ...
def call_manager(self):
self.objects.dowork(self.value1, self.value2)
In unittest I am patching the dowork with a different body, such as:
def new_dowork(self, value1, value2):
print 123
with patch('a.MyManager.dowork', new_callable=new_dowork):
record = MyModel(value=111)
record.call_manager()
...
But I am getting TypeError: new_dowork() takes exactly 3 arguments (0 given)