BrightonPy event: The Why and How of Automated Testing with Python and Django

2010-10-20 Thread Jamie Matthews
Hi all, I thought our next BrightonPy meeting might be of interest to this list: The Why and How of Automated Testing with Python and Django Jim Purbrick, Tuesday October 26, 2010, 19:30 at The Skiff http://brightonpy.org/meetings/2010-10-26/ Why do we write tests? How do we write them? What

Re: HTTP load testing tools?

2010-10-19 Thread Paul Winkler
On Oct 13, 10:27 am, Paul Winkler wrote: > On Oct 13, 4:17 am, Chris Withers wrote: > > > Hey all, > > > I hope this is still on topic, but what tool sets do people around here > > use for doingloadtestingof Django projects? > > Same stuff as for any web project.  Last time I needed something mor

Re: HTTP load testing tools?

2010-10-13 Thread Chris Withers
On 13/10/2010 09:17, Chris Withers wrote: I hope this is still on topic, but what tool sets do people around here use for doing load testing of Django projects? Thanks for the answers... ...now to ask the question in a different way again ;-) Anyone recommend any load testing services

Re: HTTP load testing tools?

2010-10-13 Thread Paul Winkler
On Oct 13, 4:17 am, Chris Withers wrote: > Hey all, > > I hope this is still on topic, but what tool sets do people around here > use for doing load testing of Django projects? Same stuff as for any web project. Last time I needed something more than ab, I used funkload (it's

Re: HTTP load testing tools?

2010-10-13 Thread Brian Bouterse
ll, > > I hope this is still on topic, but what tool sets do people around here use > for doing load testing of Django projects? > > cheers, > > Chris > > -- > Simplistix - Content Management, Batch Processing & Python Consulting > - http://www.simplis

Re: HTTP load testing tools?

2010-10-13 Thread Jonathan Barratt
On 13 ?.?. 2010, at 15:17, Chris Withers wrote: > Hey all, > > I hope this is still on topic, but what tool sets do people around here use > for doing load testing of Django projects? I use httperf generally, haven't found a need to find something different for Django - http

HTTP load testing tools?

2010-10-13 Thread Chris Withers
Hey all, I hope this is still on topic, but what tool sets do people around here use for doing load testing of Django projects? cheers, Chris -- Simplistix - Content Management, Batch Processing & Python Consulting - http://www.simplistix.co.uk -- You received this mes

Re: Testing formset validation

2010-10-08 Thread ses1984
I should also add that neither the formset nor the form report .errors or .non_form_errors() at all. On Oct 8, 6:15 pm, ses1984 wrote: > I have a pretty simple form, defined below, that I am setting > according to some initial data, and no matter what I try, I can't seem > to get it to validate i

Testing formset validation

2010-10-08 Thread ses1984
I have a pretty simple form, defined below, that I am setting according to some initial data, and no matter what I try, I can't seem to get it to validate in a test. I have created some test data, which is an array with one dictionary element, where the dictionary corresponds to the form. If I cre

Re: Confused about testing a page protected with @login_required

2010-10-06 Thread Brandon Taylor
Apparently, this is a cookie related issue: http://stackoverflow.com/questions/2705235/django-test-failing-on-a-view-with-login-required I'm using Django 1.1.1 for use with Django-CMS and Python 2.6.5, so the problem with cookies as described by the Stack Overflow article explains why my test fail

Confused about testing a page protected with @login_required

2010-10-05 Thread Brandon Taylor
Hi everyone, I set up a bare-bones project with one view decorated with @login_required. I created an initial_data.json fixture with a user. I called self.client.login(username='foobar', passowrd='foobar') and it returned True. I assigned a response variable from self.client.get('/protected/') an

Re: Mongo - testing

2010-10-03 Thread xy zz
On Oct 4, 4:20 am, Russell Keith-Magee wrote: > Well... you can call runtests; you just need to handle your own > testing infrastructure. I haven't used MongoDB (or any other noSQL > store) enough to be able to make any concrete suggestions, but I would > suggest that you&#x

Re: Mongo - testing

2010-10-03 Thread Russell Keith-Magee
tly thinking that I will > have a script to run the tests - so I can't do > > $ python manage.py test cms but instead > > $ python runserver.py cms Well... you can call runtests; you just need to handle your own testing infrastructure. I haven't used MongoDB (or any other

Re: Mongo - testing

2010-10-03 Thread xy zz
> > $ python runserver.py cms Oops - I meant $ python runtests.py cms -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-us

Mongo - testing

2010-10-03 Thread xy zz
Hello, A couple of questions regarding nosql. I am interested in MongoDB in particular, but general answers are also ok. * Is there any work going on in Django to support nosql databases? I am aware of django-nonrel but will nosql support be a part of Django core or contrib sometime? If yes, w

Re: Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Sorry, the second test is the one that fails. On Sep 26, 2:01 pm, Brandon Taylor wrote: > Hi Everyone, > > I'm having an issue testing a page protected with @login_required. I'm > loading a user via a fixture. I can call > self.client.login(**credentials) successfully

Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Hi Everyone, I'm having an issue testing a page protected with @login_required. I'm loading a user via a fixture. I can call self.client.login(**credentials) successfully and get True back. I can retrieve a User object using the _auth_user_id key held in session from the call to self.cl

Testing with a non-model database

2010-09-20 Thread andrew cooke
Hi, I am using multiple databases. My main database is working fine in tests, but the database used by the standard Python OpenID library is causing problems because it is not defined via a Django model. The OpenID library provides a way to generate the database at the command line, but I canno

Re: Unit testing in django without using test client

2010-09-17 Thread Paul Winkler
On Fri, Sep 17, 2010 at 10:58:19AM +0530, girish shabadimath wrote: > hi Paul, > > thanks for d reply,,,but im new to python n django,,,dint do ne python unit > testing before,,can u plz give me some links or hints to start with... http://docs.djangoproject.com/en/1.2/topics/testing/

Re: Unit testing in django without using test client

2010-09-17 Thread Paul Winkler
On Fri, Sep 17, 2010 at 10:58:19AM +0530, girish shabadimath wrote: > hi Paul, > > thanks for d reply,,,but im new to python n django,,,dint do ne python unit > testing before,,can u plz give me some links or hints to start with... http://docs.djangoproject.com/en/1.2/topics/testing/

Re: Unit testing in django without using test client

2010-09-17 Thread Carlton Gibson
Hi Girish, On 17 Sep 2010, at 06:28, girish shabadimath wrote: > thanks for d reply,,,but im new to python n django,,,dint do ne python unit > testing before,,can u plz give me some links or hints to start with... IN that case I'd recommend this book: http://www.amazon.com/Dja

Re: Unit testing in django without using test client

2010-09-16 Thread girish shabadimath
hi Paul, thanks for d reply,,,but im new to python n django,,,dint do ne python unit testing before,,can u plz give me some links or hints to start with... On Thu, Sep 16, 2010 at 8:09 PM, Paul Winkler wrote: > On Sep 16, 10:11 am, girish shabadimath > wrote: > > than

Re: testing app with multi db's one of which is read-only

2010-09-16 Thread Russell Keith-Magee
ent > privileges error when trying to create/destroy > the testing database on the read-only database. > > is this a bug or and rfe? RFE. Django doesn't currently have a concept of a "read only" database; when you run a test, it tries to create a test version of any datab

Re: unit testing and not creating database for read only database

2010-09-16 Thread keith
created http://code.djangoproject.com/ticket/14296 On Sep 16, 4:22 pm, keith wrote: > I have the same problem, have you logged a ticket for this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...

Re: unit testing and not creating database for read only database

2010-09-16 Thread keith
I have the same problem, have you logged a ticket for this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr.

testing app with multi db's one of which is read-only

2010-09-16 Thread keith
I have an app that accesses two different databases which are defined in settings.py one of them is read-only and its models all have managed=False, when i run 'manage.py test', unsurprisingly i guess, i get an insufficient privileges error when trying to create/destroy the testing datab

Re: Unit testing in django without using test client

2010-09-16 Thread Paul Winkler
On Sep 16, 10:11 am, girish shabadimath wrote: > thanks for reply, > actually i used unit test to test urls and other view functions,,,there is a > module called Client() in django which acts as a browser to test urls,,, > > my problem is ,i want to test other methods in my project,,, how to do >

Re: Unit testing in django without using test client

2010-09-16 Thread girish shabadimath
thanks for reply, actually i used unit test to test urls and other view functions,,,there is a module called Client() in django which acts as a browser to test urls,,, my problem is ,i want to test other methods in my project,,, how to do so, without making use of django's test client..?.. O

Re: Unit testing in django without using test client

2010-09-16 Thread Shawn Milochik
You can use Python's unittest module to test any Python code (including Django code). What is it about Django's test client or TestCase class that is a problem for you? Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this gr

Unit testing in django without using test client

2010-09-16 Thread girish shabadimath
hi,,, i need to do unit testing in one of d django project, is there any other way to test functions ( or methods ) without using test client..? -- Girish M S -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group,

Django --Unit testing view functions

2010-09-06 Thread girish shabadimath
hi,,, anybody help me with testing django views,,, * wat all things need to be tested for view functions..? * little bit confused about d usage of these two-- self.failUnlessEquals(XXX, XXX) and self.assertEquals(XXX, XXX) both seems to be same for me,, * any related books or links is

Re: defining models for unit testing only

2010-08-22 Thread Atamert Ölçgen
the > functionality of the class depends on a model. The testing docs do not > mention anything about this. If you define some models in your tests.py file they will be available (only) when you run your tests. -- Saygılarımla, Atamert Ölçgen -+- --+ +++ www.muhuk.com mu...@jabbe

defining models for unit testing only

2010-08-21 Thread mack the finger
the class depends on a model. The testing docs do not mention anything about this. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send em

Re: unit testing and not creating database for read only database

2010-07-29 Thread thusjanthan
Any suggestions? On Jul 7, 2:21 pm, thusjanthan wrote: > Hi, > > So I have a read only database called "information" which has been > modeled in the django framework with the managed=false for the META on > all its tables. When I run unit tests on another app I do not want the > unit tests to go

testing with multiple databases

2010-07-27 Thread berto
what database a table belongs in depending on the application a model is in. This configuration has a few bumps when testing. First, loading fixture data into a database other than the default, does not work with the 'fixtures' list in a TestCase. I tracked the problem down to the fixtures on

Re: Testing many-to-many models on a legacy database

2010-07-11 Thread derek
On Jul 11, 4:23 pm, derek wrote: > On Jul 10, 4:40 pm, Rolando Espinoza La Fuente > wrote: > > > > > On Sat, Jul 10, 2010 at 9:31 AM, Derek wrote: > > > Running Django 1.2.1 under Python 2.6. > > > I am obviously missing something cruccial, but I am just not sure where > > > this > > > is... >

Re: Testing many-to-many models on a legacy database

2010-07-11 Thread derek
On Jul 10, 4:40 pm, Rolando Espinoza La Fuente wrote: > On Sat, Jul 10, 2010 at 9:31 AM, Derek wrote: > > Running Django 1.2.1 under Python 2.6. > > I am obviously missing something cruccial, but I am just not sure where this > > is... > > I have a setup which includes a number of many-to-many mo

Testing custom inclusion tag

2010-07-11 Thread Julian
{%% include_tagcloud %s %%} """ % argument My approach for testing template-tags was: def test_taglist_project(self): t = Template(self.get_taglist_template("")) c = Context({}) t.render(c) and then I tested the members of `c`, for example self.assertEqu

Nose Testing

2010-07-10 Thread Binh
Hi, Does anyone know how to get nose testing to work on Google App Engine (dev_appserver.py)? I have given django-nose a try. It works fine on django1.2.1 without dev_appserver. Also, does anyone know how to hook up nose plugins with django-nose such as freshen? Thank you so much for helping

Re: Testing many-to-many models on a legacy database

2010-07-10 Thread Rolando Espinoza La Fuente
On Sat, Jul 10, 2010 at 9:31 AM, Derek wrote: > Running Django 1.2.1 under Python 2.6. > I am obviously missing something cruccial, but I am just not sure where this > is... > I have a setup which includes a number of many-to-many models in a legacy > database.  For example: > > class Grouping(mod

Testing many-to-many models on a legacy database

2010-07-10 Thread Derek
not give me the above error anymore, but when I rerun the "python manage.py test", I get: _mysql_exceptions.OperationalError: (1050, "Table 'taxagreement_grouping' already exists") So obviously the problem - and I am not sure exactly what that is? - is not fi

unit testing and not creating database for read only database

2010-07-07 Thread thusjanthan
Hi, So I have a read only database called "information" which has been modeled in the django framework with the managed=false for the META on all its tables. When I run unit tests on another app I do not want the unit tests to go and create a test database for "information" but would rather like t

Re: trying to do console testing of my models, "no module named X"

2010-06-24 Thread euan.godd...@googlemail.com
If you do: python manage.py shell you will get a python shell with all the necessary paths set up so that you can do your testing. You may also want to consider some sort of automated testing as it makes this sort of thing a lot easier and quicker. Euan On 24 June, 05:04, robinne wrote: >

trying to do console testing of my models, "no module named X"

2010-06-23 Thread robinne
I have a django project running on local linux machine with apache. I run this at localhost:8081 and I use import statements to import my models in my views (e.g. "from DjangoSite.ManageProducts.models import Member"). For testing, I want to be able to import my models into python conso

Re: testing client.get('/yo/', {}, HTTPS='on') ?

2010-05-27 Thread nikolaj.baer
> Starting at > ...http://docs.djangoproject.com/en/dev/topics/testing/#django.test.clie... > > ... how do we test with HTTPS turned on? This doesn't work: > >   client.get('/yo/', {}, HTTPS='on') Of course the answer is that Django tes

testing client.get('/yo/', {}, HTTPS='on') ?

2010-05-27 Thread Phlip
Djangoists: Starting at ... http://docs.djangoproject.com/en/dev/topics/testing/#django.test.client.Client.get ... how do we test with HTTPS turned on? This doesn't work: client.get('/yo/', {}, HTTPS='on') All we can find is documentation to turn it off, which is so

Re: testing the comment framework using the test client

2010-05-26 Thread Alex Robbins
The way I've tested it in the past is: GET the page, using the client. Scrape the values you need. (BeautifulSoup makes this really easy, but you can do it with python's builtin stdlib I guess.) POST the comment message, along with all the values you just scraped. Hope that helps, Alex On May 25

testing the comment framework using the test client

2010-05-25 Thread Thierry
How do you guys test implementations of the django comment framework? A regular post doesnt seem to work because it depends on data from a previous get. An thoughts? def test_comment(self): item_url = reverse('item', args=['4558']) self.client.login(username=self.username, pass

Re: Testing custom management commands

2010-05-15 Thread Russell Keith-Magee
 test_command.handle_noargs() > > I have added a boolean flag option to this command, so I would like to > split this test case in two, where one case sets up the command as > with the flag set to true, and one case where the flag is false. > > I tried looking for testing coverage of

Re: Testing custom management commands

2010-05-14 Thread ses1984
If I could add, in my tests, I was testing to see whether the command executed successfully and I was inspecting the state of the database after the command executed. On May 14, 3:04 pm, ses1984 wrote: > I am interested in writing unit tests to cover some custom commands I > have writte

Testing custom management commands

2010-05-14 Thread ses1984
test case in two, where one case sets up the command as with the flag set to true, and one case where the flag is false. I tried looking for testing coverage of django's own management commands, but I was unable to find those. -- You received this message because you are subscribed to th

Creating models for testing

2010-05-02 Thread eka (Esteban)
Hi all I'm developing an app for a project and I would like to test it but with models that are not from the project itself nor from the app. So is there a way to create models that are used only in tests? In the way that they are created only at test run and not at a normal syncdb? Note: I'm usi

Re: Testing email with the testserver

2010-03-26 Thread Russell Keith-Magee
On Fri, Mar 26, 2010 at 11:29 PM, Ben Gerdemann wrote: > I found the Django documentation about testing E-mail services > confusing. It says here > http://docs.djangoproject.com/en/1.1/topics/testing/#e-mail-services > "Django's test runner automatically redirects all Dja

Re: Testing email with the testserver

2010-03-26 Thread Phlip
Ben Gerdemann wrote: > I am using "manage.py testserver" and Selenium to drive the browser. Therefor you are running thru the real webserver, not its mock. And, incidentally, most testing effort should be in unit tests - Selenium should _only_ test the last mile of integration, whe

Testing email with the testserver

2010-03-26 Thread Ben Gerdemann
I found the Django documentation about testing E-mail services confusing. It says here http://docs.djangoproject.com/en/1.1/topics/testing/#e-mail-services "Django's test runner automatically redirects all Django-sent e-mail to a dummy outbox", but the example code shows using th

Re: Creating sample users for testing

2010-03-24 Thread Ivan Uemlianin
Dear Dave Thanks, that does look useful. Seeing Ian's solution I was wondering if I could manage.py in some way. Best wishes Ivan On Mar 23, 4:55 pm, Dave Murphy wrote: > On Mon, Mar 22, 2010 at 12:26 PM, Ivan Uemlianin wrote: > > > I'm now thinking a fixture might not be the right way to go

Re: Creating sample users for testing

2010-03-23 Thread Dave Murphy
On Mon, Mar 22, 2010 at 12:26 PM, Ivan Uemlianin wrote: > > I'm now thinking a fixture might not be the right way to go: it might > be better to have a little script to add users once syncdb is done. > As well as allowing me to provide plain text passwords, I could easily > add site-specific attri

Re: Creating sample users for testing

2010-03-23 Thread Ivan Uemlianin
Dear Ian That's great! Exactly my use case. Thanks very much for your help. Best wishes Ivan -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group,

Re: Creating sample users for testing

2010-03-23 Thread Ian McDowall
27;, 'gru...@7dwfs.com'],\ ['sleepy', 'Sleepy', 'Dwarf', 'sle...@7dwfs.com'],\ ['dopey', 'Dopey', 'Dwarf', 'do...@7dwfs.com'],\ ['doc', 'Doc', 'Dwarf', 'd...@7dwfs.com'],\

Creating sample users for testing

2010-03-22 Thread Ivan Uemlianin
Dear All I'd like to create a bunch of sample users for testing a django website. I was going down the road of using an initial_data fixture, but there seem to be a couple of problems with this: - Can I supply partial data in initial_data, i.e. only auth.user info (at the moment, usernam

Re: Testing if a file has changed while saving the class

2010-03-10 Thread Beres Botond
Just a quick idea off the top of my head before going to bed :) def save(self, *args, **kwargs): super(MyModel, self).save(*args, **kwargs) # Call the "real" save() method. timestamp = os.path.getmtime(self.my_image_field.path) if datetime.datetime.now() - timestamp < VERY_

Testing if a file has changed while saving the class

2010-03-09 Thread Xavier Ordoquy
Hi, I have a class with an image field. Every time the image is changed, I need to resize the image to several formats. At the moment, I do that every time the class which contains the image is saved. However, I'd like to improve that a bit and only resize whenever the image has changed. Is ther

Re: About response.status_code on testing

2010-03-02 Thread raj
You're Right. The problem is that my attempt at client.login() has failed somehow. Rajeesh. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, se

Re: About response.status_code on testing

2010-03-02 Thread raj
Had tried with login using client.login() and the above result was after that. Will try with printing out response.content. Thanks for the time spent. Rajeesh. On Mar 2, 7:03 pm, Daniel Roseman wrote: > Doing "print response.content" before the assertion should show what's > going on. My suspici

Re: About response.status_code on testing

2010-03-02 Thread Daniel Roseman
min(admin.ModelAdmin): >     def change_view(self, request, object_id, extra_context=None): >          raise ValueError, 'testing' >          super(MyModelAdmin, self).change_view(self, request, > object_id, extra_context) > > Rajeesh. Doing "print response.content" befo

Problem with queryset during model unit-testing

2010-02-12 Thread Alexey
First, the code of my tests.py def test_get_current(self): m = Member.objects.create(...) q = Question.objects.create(name="q1", text="q1", start_datetime=self.day_before, close_datetime=self.day_after, type=self.type) r = Response.objects.create(question=q, text='response') expect

Re: Unit testing Templatetags

2010-02-07 Thread Jari Pennanen
> here:http://github.com/darkrho/django-dummyimage/blob/master/dummyimage/te... Great example. IMO, there should be more unit-testing examples in Django documentation, templatetags should be one... -- You received this message because you are subscribed to the Google Groups "Django users" gr

Re: Unit testing Templatetags

2010-02-07 Thread Rolando Espinoza La Fuente
On Sun, Feb 7, 2010 at 3:56 PM, Jari Pennanen wrote: [...] > >            #print > loader.get_template_from_string(template_content).render(self.context) >            print > template.Template(template_content).render(self.context) > > >    if __name__ == '__main__': >        unittest.main() > > B

Unit testing Templatetags

2010-02-07 Thread Jari Pennanen
Hi! I decided to try to unit test templatetag using following code: import unittest from django import template from django.template import loader register = template.Library() @register.simple_tag def sometag(arg=None): return "ok" class MyTagTests(unittes

Re: any suggestion about how to build Continuous testing for django project?

2010-02-02 Thread Simon Brunning
On 1 February 2010 17:25, pyleaf wrote: > I am new for django. > any suggestion about how to build Continuous testing for django project? If you build your Django app with buildout (<http://bit.ly/cmdMQy>) you could try Hudson (<http://bit.ly/aSPpog>). I'm going to be giv

Re: any suggestion about how to build Continuous testing for django project?

2010-02-02 Thread timc3
Or you could try BuildBot. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more opt

Re: any suggestion about how to build Continuous testing for django project?

2010-02-02 Thread Phlip
pyleaf wrote: > what about bitten? I can't find a screenshot. Can it compete with this? http://c0485891.cdn.cloudfiles.rackspacecloud.com/620ad37c-398d-4509-ae45-b88399c1c4a6_2_full.jpeg Also note that _none_ of those should be red. I'm sure the crew only broke them just to illustrate the alarm

Re: any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread pyleaf
what about bitten? On Tue, Feb 2, 2010 at 4:12 AM, Phlip wrote: > pyleaf wrote: > > > I am new for django. > > any suggestion about how to build Continuous testing for django project? > > install fabric - and don't worry about its remote options yet. Then > cr

Re: any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread Phlip
pyleaf wrote: > I am new for django. > any suggestion about how to build Continuous testing for django project? install fabric - and don't worry about its remote options yet. Then create a fabfile.py at the root of your app. Create 3 targets; pull, test, and int. They pull from Git

any suggestion about how to build Continuous testing for django project?

2010-02-01 Thread pyleaf
I am new for django. any suggestion about how to build Continuous testing for django project? -- Believing is Everything. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegrou

Re: About unit testing

2010-01-22 Thread Dougal Matthews
If you look at the tests in django-shorturls you can see how they created models that were only used for the tests: http://github.com/jacobian/django-shorturls/tree/master/src/shorturls/tests/ --- Dougal Matthews - @d0ugal http://www.dougalmatthews.com/ 2010/1/22 Gabriel Reis > Hi, > > I w

Re: About unit testing

2010-01-22 Thread Larrik Jaerico
What are you actually trying to accomplish? On Jan 22, 6:25 am, Gabriel Reis wrote: > Hi, > > I would like to know if it is mandatory to create an application and define > my model in the models.py file or if it is possible to define a model > locally in my test method (inside my TestCase class)

About unit testing

2010-01-22 Thread Gabriel Reis
Hi, I would like to know if it is mandatory to create an application and define my model in the models.py file or if it is possible to define a model locally in my test method (inside my TestCase class) and interact with it and saving without creating an application and the models.py. In other wor

Re: Need help testing views with csrf in 1.1.1

2010-01-08 Thread Skylar Saveland
In case anyone else runs across this, the answer appears to be: disable csrf protection while testing. On Jan 8, 7:04 pm, Skylar Saveland wrote: > I wondering what I'm doing wrong here.  These views work as expected > with a browser.  I was looking to improve my test coverage. > &g

Need help testing views with csrf in 1.1.1

2010-01-08 Thread Skylar Saveland
I wondering what I'm doing wrong here. These views work as expected with a browser. I was looking to improve my test coverage. >>> c = Client() >>> get_response = c.get( reverse('create', kwargs={'typ':'residential'}) ) >>> get_response.status_code 200 >>> post_response = c.post( reverse('create

Re: Testing and request META data

2009-12-28 Thread Phlip
> Now how do I test an action that must use SSL? (I want a 304 bounce > message if the user tries to use plain text.) This looks promising! class SSLAwareClient(Client): def __init__(self, *args, **kwargs): super(SSLAwareClient, self).__init__(*args, **kwargs) self.ssl = False

Re: Testing Newforms for Blankness

2009-12-24 Thread Aristotle Miternan
Whoops, I think I misstated my use case. A better description: All the fields are required, but I don't want to return a forms.ValidationError if the entire form is blank, but I do if it is partially filled, I simply want to drop it. Perhaps this is simply bad design. Upon further consideration I

Re: Testing Newforms for Blankness

2009-12-24 Thread Aristotle Miternan
Hi Shawn, I am referring to forms.ModelForm, I think it might apply to forms as well, but I can't think of a good use case off the top of my head. I suppose I might have an uncommon use case. I display a form that has several optional parts (that have different models) that can be dynamically add

Re: Testing Newforms for Blankness

2009-12-24 Thread Shawn Milochik
On Dec 24, 2009, at 2:51 PM, Aristotle Miternan wrote: > Hello all, > >I'm fairly new to Django and I noticed a curious behavior of > forms. I noticed that there is no simple way to test a form for a form > not being filled at all. I think it might be a semi-common use case > that you might

Testing Newforms for Blankness

2009-12-24 Thread Aristotle Miternan
Hello all, I'm fairly new to Django and I noticed a curious behavior of forms. I noticed that there is no simple way to test a form for a form not being filled at all. I think it might be a semi-common use case that you might want to simply not generate a new model instance if a form has no in

Re: Adding models during testing (aka working around #7835)

2009-12-22 Thread Peter Baumgartner
On Tue, Dec 22, 2009 at 1:34 PM, Peter Baumgartner wrote: > I'm trying to use the suggestion here[1] for adding models during test > suite runs. While it works great in sqlite, I'm not having any luck > getting it to run in Postgres because it doesn't seem to build all the > necessary database rel

Re: Testing and request META data

2009-12-22 Thread Phlip
> >>> c = Client() > >>> c.get('/customers/details/', {'name': 'fred', 'age': 7}, > > ...       HTTP_X_REQUESTED_WITH='XMLHttpRequest') Thanks! Now how do I test an action that must use SSL? (I want a 304 bounce message if the user tries to use plain text.) I couldn't find a HTTPS or similar hea

Adding models during testing (aka working around #7835)

2009-12-22 Thread Peter Baumgartner
I'm trying to use the suggestion here[1] for adding models during test suite runs. While it works great in sqlite, I'm not having any luck getting it to run in Postgres because it doesn't seem to build all the necessary database relations. (ProgrammingError: relation "fakeapp_fakeitem" does not exi

Re: Testing Django applications

2009-12-15 Thread Jonas Obrist
HB wrote: > Hey, > Grails framework offers a huge set of tools to facilitate testing > (unit and integration) > I heard the same thing is true for Rails > Does Django offers the same thing? > Thanks. > > -- > > You received this message because you are subscribed t

Testing Django applications

2009-12-15 Thread HB
Hey, Grails framework offers a huge set of tools to facilitate testing (unit and integration) I heard the same thing is true for Rails Does Django offers the same thing? Thanks. -- You received this message because you are subscribed to the Google Groups "Django users" group. To po

Re: Testing and request META data

2009-12-09 Thread Russell Keith-Magee
header on a test client? > > Bump? I just hit this problem, and the above question is the only > traffic on it... >From the testing docs [1]: """ The extra keyword arguments parameter can be used to specify headers to be sent in the request. For example: >>>

Testing and request META data

2009-12-09 Thread Phlip
On Aug 14 2008, 5:39 am, "Hajo Smulders" wrote: > I need to set the HTTP_REFERER in the request.META data of a test client so > that i can unit test a view. > How do I do this? ie: How do i fake an HTTP header on a test client? Bump? I just hit this problem, and the above question is the only tr

Re: middleware to log request/response objects for testing purposes?

2009-11-25 Thread Tim Valenta
http://code.google.com/p/django-logging/ *shrug* I haven't used it, but he's got a screen-cast about how the thing is set up. He builds it off of built-in Python logging modules. It looks like it provides some decorators for suppressing logging output on methods, etc. Might be worth the time t

middleware to log request/response objects for testing purposes?

2009-11-25 Thread Sean Neilan
Dear Django Community, I am curious if anyone has built some middleware to log all request/ response objects & possibly view & exception calls. I could do this myself easily, but, I would like to not reinvent the wheel. Thank you for your time. -Sean Neilan -- You received this message because

Re: Problem with unmanaged models and unit testing

2009-11-24 Thread Tomasz Zieliński
Thank you for you responses, I think I spotted the problem. My unmanaged model is in fact wrapper for database view. It also inherits from Django abstract model that has ManyToManyField-s onboard. When trying to test my app, syncdb.py in line 93 tries to actually add foreign key pointing from m2m

Re: [1.1] Problem with unmanaged models and unit testing

2009-11-13 Thread Craig Kimerer
Probably a constraint problem on the tables being created. Logging into to your MySQL server via command line and running either 'show myisam status' or 'show innodb status' (depending on what type of tables you are making) should provide you with more useful information. Craig On Fri, Nov 13, 2

Re: [1.1] Problem with unmanaged models and unit testing

2009-11-13 Thread Russell Keith-Magee
2009/11/14 Tomasz Zieliński : > Hello > > I have a problem with when trying to test app that is using unmanaged > models: > > (...) > Creating table sometable > Traceback (most recent call last): >  File "H:\myproject\manage.py", line 11, in >    execute_manager(settings) >  File "C:\Python26\lib\

[1.1] Problem with unmanaged models and unit testing

2009-11-13 Thread Tomasz Zieliński
Hello I have a problem with when trying to test app that is using unmanaged models: (...) Creating table sometable Traceback (most recent call last): File "H:\myproject\manage.py", line 11, in execute_manager(settings) File "C:\Python26\lib\site-packages\django\core\management \__init__.

Re: Unit testing form validation issue

2009-10-27 Thread Chris Allen
Ended up populating the test database with fixtures via .json dumps. Thank you very much for your help. --- Chris On Oct 26, 6:19 pm, Karen Tracey wrote: > On Mon, Oct 26, 2009 at 4:12 PM, Chris Allen wrote: > > > Anyone have any experience with forms (ModelMultipleChoice fields and > > forei

Re: Unit testing form validation issue

2009-10-26 Thread Karen Tracey
On Mon, Oct 26, 2009 at 4:12 PM, Chris Allen wrote: > > Anyone have any experience with forms (ModelMultipleChoice fields and > foreignkey'd choice fields) not validating properly in a unit test but > just fine in the runserver? > > Passing the same request.POST data to the unit test as I am in t

<    2   3   4   5   6   7   8   9   10   11   >