NIlesh Sharma
NIlesh Sharma

Reputation: 5665

Flexmock a django model object gives model objects?

I am trying to flexmock a django model object, but when I mock it then also it gives me that object itself. How can I mock it then ?

So there was a model object I created in a method like this

aa = ModelName()

now when I tried to mock it, like this

from flexmock import flexmock
bb = flexmock(aa)

the type of bb is still django model object, it's not flexmock object. How can I mock it successfully ?

Upvotes: 1

Views: 182

Answers (1)

mariodev
mariodev

Reputation: 15594

If you look carefully, the flexmock function is actually modifying the aa object, so it is a partial mock. It has all the necessary methods.

Upvotes: 0

Related Questions