Monday, November 28, 2011

Re: django tests. where to create users

On 11/28/2011 01:58 AM, Gelonida N wrote:
> Hi,
>
> I'd like to run some django tests, which use the test client and which
> should check, that certain users can only access certain contents.
>
> Where would you create this users / passwords.
> - With a fixture
> - as part of a test class in the SetUp section and tear
> it down afterwards?
>
> - create a custom test runner with a setup phase ?
>
> Is there any other recommended code section, which could do the setup
> prior to running tests.
>
> Ideally I'd like to avoid fixtures.
> Of course I could create a script to generate certain fixtures and run
> only then the tests, but I'd prefer, the user data is created ad part of
> the test procedure.
>
>

I played a little more with django unit tests.

Django will reset the data base after each single test.

So it seems, I am stuck with fixtures at least at the moment I do not
know how to create users without fixtures such, that they would be
persistent between unit tests.

I really don't want to use fixtures, but some warm up code run only once
prior to running tests.

Any ideas?


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment