dimanche 10 janvier 2016

Calling a function in factory boy test with **kwargs

I'm trying to write a test in which i have to call a model's function which accepts **kwargs here is function from my model

def send_message(self, **kwargs):
    from django.core.mail import send_mail
    from django.conf import settings
    send_mail(
            recipient_list=[self.email_from,],
            from_email=settings.INFORMATION_FROM,
            **kwargs
        )

and this is where i am trying to access this mention function in test

def test_send_message(self):
    send_message = self.user.send_message()
    print send_message  

and getting this error TypeError: send_message() takes at least 4 arguments (2 given)

Aucun commentaire:

Enregistrer un commentaire