Re: testing a django package

2012-09-13 Thread Jonas Geiregat
Found the answer: I need to put from tests import * in the tests/__init__.py file > Actually, Django TestCases can override the URLConf, which allows you to have > a given URL for a given view in your test: > > from django.test import TestCase > > class MyTestCase(TestCase): > urls =

Re: testing a django package

2012-09-13 Thread Jonas Geiregat
Thanks you for your help. I understand now how I should setup testing for a django package. I'm using django-registration as an example , which works a similar way. I have a weird problem at hand. I'm creating a django package and would like to provide some test cases for it. The package is

Re: testing a django package

2012-09-12 Thread Thomas Orozco
Actually, Django TestCases can override the URLConf, which allows you to have a given URL for a given view in your test: from django.test import TestCase class MyTestCase(TestCase): urls = 'mypackage.tests.urls' def test_something(): # Do stuff... >From there, you can

Re: testing a django package

2012-09-12 Thread Jonas Geiregat
> I think you could create an urls.py file for your tests and attach > your views there. Then use the test client to direct requests to those > test URLs and assert that the response is what you expect. I didn't know that could work. I think I'll also need to create views that extend these

Re: testing a django package

2012-09-12 Thread Thomas Orozco
I think you could create an urls.py file for your tests and attach your views there. Then use the test client to direct requests to those test URLs and assert that the response is what you expect. Now, this is probably not going to be practical to test your jQuery components, but you might want

Re: testing a django package

2012-09-12 Thread Jonas Geiregat
I can now show you what I really would like to write tests for. https://github.com/jonasgeiregat/django-ajax-forms The code I would like to test is in ajax_forms/views.py mainly the AjaxFormView and the AjaxModelFormView. Any help is appreciated! > >> Is it a view mix in? >> > The package

Re: testing a django package

2012-09-11 Thread Jonas Geiregat
> Is it a view mix in? > The package actually already changed from containing a view mix in to actual views that should be subclassed by the users using the package. > It's a bit difficult to tell you much without more information. > For example, a view derived from FormView. Like I said the

Re: testing a django package

2012-09-11 Thread Thomas Orozco
Is it a view mix in? It's a bit difficult to tell you much without more information. A few you things that you may find useful or not for testing : . Test cases can override settings such as the urlconf . There's a test client to test views . Class based views can sometimes be tested without