mardi 21 février 2017

Test how many method calls occured and what arguments was passed (test django mixin class)

I have a django mixin class with several methods coded like in following simple example:

class Mixin(object):
    def method1(self):
        A = self.A # this is dictionary 
        B = self.B
        C = self.C
        D = self.D

        for i,j in self.A.iteritems():
            self.method2(B, C, D, i, j)

   def method2(self, arg1, arg2, arg3, arg4, arg5):
       pass

Mixin class declaration don't provide any of A,B,C,D arguments. These will be specified in view class.

I want to test how many method2 calls occured and what arguments were passed in every call.

I'll be grateful for any idea how could I handle this problem.

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire