Re: mocking out a Model

2012-04-15 Thread Arruda
Have you ever tried model-mommy? It's has some nice features, don't know if you find what you want there but it's a good shot. Em sábado, 14 de abril de 2012 08h49min06s UTC-3, jonas escreveu: > > Hello, > > I'm trying to test a function that imports and acts upon a django model, > named House.

Re: mocking out a Model

2012-04-15 Thread HarpB
I would recommend that you don't use the patch decorator, but rather the patch function itself. Here is a wrapper function I used when patching classes and functions (assuming you are using TestCase class): def patch(self, *args): if len(args) == 2: patcher = patch.object(

Re: mocking out a Model

2012-04-15 Thread Jonas Geiregat
>> @patch('apps.market.models.House') > > Is create house in apps.market.models, or is it somewhere else? If > it's somewhere else, mock it relative to that file eg: > @patch('apps.some_file.House') def create_house can be found in apps/deps/house_factory.py Inside house_factory I ' from apps.m

Re: mocking out a Model

2012-04-14 Thread Andy McKay
> @patch('apps.market.models.House') Is create house in apps.market.models, or is it somewhere else? If it's somewhere else, mock it relative to that file eg: @patch('apps.some_file.House') > I'm also wondering if it's possible to inspect MockedHouse to see if it has > for example some tags adde

mocking out a Model

2012-04-14 Thread Jonas Geiregat
Hello, I'm trying to test a function that imports and acts upon a django model, named House. from apps.market.models import House def create_house(location, date, price): house = House(id=None, date, price) house.save() # calculate some stuff and further expand the hous