python - How to test for the second parameter of a mocked method? -


I am trying to duplicate the sendEmails () method and if the second parameter is " Test@test.com "is called with an email address.

  @ mock.patch ('apps.dbank.management.commands.optin_invites.OptinBase.sendEmails') def test_x_send_emails (auto, send_emails_mock): oi = optinwytesx () oi.compute (true , "Test@test.com") self.assertTrue (send_emails_mock.assert_called_with (???, test_email_address = "test@test.com"))  

I assert_called_with but I do not care about the first parameter of this test case. Is there any way to accept anything for the first parameter?

I did not know how to do this when I was trying the same thing

Here is a few hooks: Optional counterfeit import MagicMock class from YesMan (object): def __eq __ (self, others): return true something = YesMan () Fake = Magic Mac () Fake (X = 123, Y = 456) mock.assert_called_once_with (x = anything, y = 456)

is an option to see the attribute

<> & gt; & Gt; & Gt; Mock.call_args call (y = 456, x = 123)

and create your own statements on that object


Comments