Re: Testing related models without saving

2015-07-30 Thread Michael Herrmann
I'm very relieved - thanks Tim! If I can help, please let me know. Best, Michael On 30 July 2015 at 17:56, Tim Graham wrote: > We are working on that solution: > https://github.com/django/django/pull/5060 > > > On Thursday, July 30, 2015 at 7:19:31 AM UTC-4, mic...@herrmann.io wrote: >> >> Hi a

Re: Testing related models without saving

2015-07-30 Thread Tim Graham
We are working on that solution: https://github.com/django/django/pull/5060 On Thursday, July 30, 2015 at 7:19:31 AM UTC-4, mic...@herrmann.io wrote: > > Hi all, > > I've just been bitten by this new "feature" as well. I completely don't > understand this design decision of 1.8. It is very useful

Re: Testing related models without saving

2015-07-30 Thread michael
Hi all, I've just been bitten by this new "feature" as well. I completely don't understand this design decision of 1.8. It is very useful to be able to create model classes without having to save them to the database, not just for unit tests but also for experimenting in the shell. The new "fea

Re: Testing related models without saving

2015-07-16 Thread Carl Meyer
Hi Roland, On 07/16/2015 07:46 AM, Roland Swingler wrote: >> i'll just say that Django tests don't favor too much into the "unit" > test spectrum; > > That is what I'm seeing - it is the same with rails out of the box as > well. I guess I'm just curious to know whether: > > a) the 'unit' test en

Re: Testing related models without saving

2015-07-16 Thread Roland Swingler
> i'll just say that Django tests don't favor too much into the "unit" test spectrum; That is what I'm seeing - it is the same with rails out of the box as well. I guess I'm just curious to know whether: a) the 'unit' test end of the spectrum is feasible if that's what you like b) what is avail

Re: Testing related models without saving

2015-07-16 Thread Javier Guerra Giraldez
On Thu, Jul 16, 2015 at 8:18 AM, Roland Swingler wrote: > I understand that the test db uses a different schema (it's the same in > rails), the point is to be able to run tests isolated from having a database > at all. there are several testing styles, each one with different dogmas. discussions

Re: Testing related models without saving

2015-07-16 Thread Roland Swingler
Hi, Thanks for the link - I'll investigate that further, especially as to whether you can set that dynamically. I understand that the test db uses a different schema (it's the same in rails), the point is to be able to run tests isolated from having a database at all. Thanks, Roland -- You

Re: Testing related models without saving

2015-07-16 Thread Bruno A.
This might help maybe: https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey.allow_unsaved_instance_assignment On Thursday, 16 July 2015 12:21:30 UTC+1, Roland Swingler wrote: > > Hi all, > > I've very recently come to to Django from a rails background, and > stru

Re: Testing related models without saving

2015-07-16 Thread Bruno A.
You did not quote your models, but I assume your UserProfileDetails has a OneToOne or ForeignKey relationship with User model. With Django, you generally need to save the related model before adding it to the Foreignkey, as the relationship in UserProfileDetails is using the primary key (called

Testing related models without saving

2015-07-16 Thread Roland Swingler
Hi all, I've very recently come to to Django from a rails background, and struggling to do unit testing of Django models without saving to the database as I'm used to in Rails. Lets say you have 2 linked models, for example User and UserProfileDetails, then in my tests I want to set up the str