Hi Arun,

thanks for this advice. I finally came also to the conclusion that the best 
test would be to create (as part of each test case) all possible use case 
szenarios for this mixin class. For instance if it should be utilizable for 
ListView and CreateView then i would create unit tests against those 2 classes 
with an inheritance of that mixin. This should be the only way to quarantee 
the correct behavior of the mixin within a given use case. 

If someone would use the mixin outside of this, let's say for DetailView and 
this was not explicit tested then there is no gurantee that it will still 
behave as expected. That should be fair enought.

Thanks,
Sven

On Monday 06 January 2014 02:08:29 trojactory wrote:
> Hi sassman,
> 
> Since you mentioned TDD, I assume you are talking about unit tests. As with
> any matter in quality control, the more you can test, the better!
> 
> In my opinion, you would need to provide atleast one testcase for each of
> the four CBV views. It is better to create a derived class in each case
> rather than mocking it.
> 
> Regards,
> Arun
> 
> On Monday, January 6, 2014 12:01:30 AM UTC+5:30, sassman wrote:
> > Hi Folks,
> > 
> > i recently wrote some small mixins that are intented to be attached to CBV
> > like ListView, UpdateView, DetailView or even CreateView. The aim is to
> > give
> > users only access to their data. Their in terms of ownership. As an
> > Example
> > you have a Post model were a field called owner is a ForeignKey to
> > 'auth.User'
> > as a basic example.
> > 
> > So the mixin does filtering the queryset and passes an additional
> > parameter to
> > form classes where as an additional form Mixin then passes this down to
> > the
> > model. So far so good. (see http://pastebin.kde.org/pyzrouxfw)
> > 
> > Now my Question:
> > 
> > what would be the best solution to write a dedicated test against this
> > mixin?
> > Would it be good or worth to create some Views loke the 4 above that
> > inherits
> > also the Mixin and then test against this as a complete behaviour? Or
> > better
> > mock it somehow differently?
> > 
> > I really appreaciate your suggestions!!
> > 
> > 
> > 
> > 
> > Best Regards
> > 
> > Sven
-- 


Best Regards, 
Sven

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/2035044.O70feLxhn5%40gilgamesch.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to