Re: template list empty in with django test client

2011-08-28 Thread Juan Pablo Romero Méndez
My fault. I was testing from the console. Within an actual test the request does have the templates. Juan Pablo El día 28 de agosto de 2011 17:50, Juan Pablo Romero Méndez <jpablo.rom...@gmail.com> escribió: > Hello, > > I'm using the django test client, like this: > >&g

template list empty in with django test client

2011-08-28 Thread Juan Pablo Romero Méndez
Hello, I'm using the django test client, like this: >>> c = Client() >>> r = c.get("/content/new/") >>> r.status_code 200 >>> r.templates [] Is this normal? Regards, Juan Pablo -- You received this message because you are subscribed to th

Re: How to add CSRF to context when using test client???

2011-08-24 Thread Matteius
Thanks for both suggestions, I recently tried this approach and reached success when I ran my tests. So I think this is the correct approach and I'll include this CSRF style testing with my test suite now. -Matteius On Jul 7, 6:02 am, Craig Blaszczyk <masterja...@gmail.com> wrote: > c

Re: Django Test Corrupted Test Data

2011-08-20 Thread Malcolm Box
(MyTestCase, self).setUp() and other superclass methods to get the DB setup right? Malcolm On 19 August 2011 22:05, patjenk <patj...@gmail.com> wrote: > As I understand it, the database should be reset between each test. To > me this means that unless the variable being examined is

Re: Django Test Corrupted Test Data

2011-08-19 Thread patjenk
As I understand it, the database should be reset between each test. To me this means that unless the variable being examined is an attribute of self, the tests shouldn't affect each other. Could it be possible that there is a sqllite subtly that delays the reset of the table count and it affects

Re: Django Test Corrupted Test Data

2011-08-19 Thread bikkit
om> Reply-To: django-users@googlegroups.com Subject: Django Test Corrupted Test Data I have a test class that subclasses django.test.TestCase which has about 5 different tests in it. When I run my full test suite (using nose, and specifying sqlite as backend) there are a series of failures. When I

Django Test Corrupted Test Data

2011-08-19 Thread dm03514
I have a test class that subclasses django.test.TestCase which has about 5 different tests in it. When I run my full test suite (using nose, and specifying sqlite as backend) there are a series of failures. When I go to debug the tests, running them individually, they pass fine. http

Re: How to test form values in a template? (simplified)

2011-08-07 Thread Shawn Milochik
The validation is easy. Override the form's clean() method to do any validation which needs to check the value of more than one field. For example, if you want a text box to be required sometimes, define it as not required in the form, then check the boolean in clean() and raise a

Re: How to test form values in a template? (simplified)

2011-08-07 Thread Joshua Russo
on if the checkbox is selected or not. I guess what I'm trying to get at is, how should I access these values to determine the display and validation. If I don't use my method I will have to test for both the boolean value and the string value 'True' instead. That's what I'm trying to avoid

How to test form values in a template? (simplified)

2011-08-07 Thread Joshua Russo
additional information. This text field can be either displayed as a single line text input or a multi-line textarea. My problem is that I want to have these different setup values available to control the validation and display of the form, but there doesn't seem a consistent way to test

Re: How to test form values in a template? (simplified)

2011-08-07 Thread Shawn Milochik
Are you saying that you want to show some form inputs conditionally based upon configuration, for example for each user? If that's your goal then it's very easy to do by adding the logic in the form's __init__. Add/remove fields there and (possibly) override save() if you have to take any

Running test cases on pydev raises an exception due to a problem in the standard library

2011-08-02 Thread Ger
", line 19, in handle from django.test.utils import get_runner File "c:\users\gfuentes\workspace\ag\lib\site-packages\django-1.3- py2.5.egg\django\test\__init__.py", line 6, in from django.test.testcases import TestCase, TransactionTestCase, skipIfDBFeature, skipUnlessDBFeature Fi

Re: DeprecationWarning displayed in test, not in dev

2011-07-20 Thread Andre Terra
Great! Thank you Tom and Russ for the heads up. Cheers, AT On 7/20/11, Tom Evans wrote: > On Wed, Jul 20, 2011 at 3:24 AM, Russell Keith-Magee > wrote: >> The problem here actually lies with Python. >> >> For some reason, Python 2.7 changed

Re: DeprecationWarning displayed in test, not in dev

2011-07-20 Thread Tom Evans
On Wed, Jul 20, 2011 at 3:24 AM, Russell Keith-Magee wrote: > The problem here actually lies with Python. > > For some reason, Python 2.7 changed the reporting behavior of Warnings > so that DeprecationWarning is ignored by default [1]. So, because > you're developing in

Re: DeprecationWarning displayed in test, not in dev

2011-07-19 Thread Russell Keith-Magee
On Tue, Jul 19, 2011 at 11:53 PM, Tom Evans <tevans...@googlemail.com> wrote: > Hi all > > I recently upgraded one of my apps to the next iteration. This used a > third party library, which started spewing out DeprecationWarning > messages when I deployed it t

DeprecationWarning displayed in test, not in dev

2011-07-19 Thread Tom Evans
Hi all I recently upgraded one of my apps to the next iteration. This used a third party library, which started spewing out DeprecationWarning messages when I deployed it to the test site. None of these warnings appeared when I was developing, and I was wondering if there was a reason why

Re: How to add CSRF to context when using test client???

2011-07-07 Thread Craig Blaszczyk
csrf_token is a proxy object not a string. Try doing: csrf_token = '%s' % response.context['csrf_token'] -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: How to add CSRF to context when using test client???

2011-06-27 Thread andres ledesma
Hi Matteius, I stumbled across the same problem. I wanted to carry out a test case using CSRF, and I failed. I managed to add the csrf_token to my post request, but apparently this is not enough. Here I will show you the code, perhaps you will have better luck then... c = Client

Re: Test runner fails with Django 1.2.1 and psycopg2 2.4.2

2011-06-23 Thread ashwoods
do you get these errors with: 'OPTIONS': { 'autocommit': True, } ? On Jun 14, 6:06 pm, Andrew Brookins <a.m.brook...@gmail.com> wrote: > Hey, > > Yesterday I started seeing test runner failures with Django 1.2.1 and > psycog2 2.4.2. > > Here's the traceback (where [

Re: Test runner fails with Django 1.2.1 and psycopg2 2.4.2

2011-06-14 Thread Andrew Brookins
Looks like there's already a ticket (my search-fu failed me): https://code.djangoproject.com/ticket/16250 Andrew -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Test runner fails with Django 1.2.1 and psycopg2 2.4.2

2011-06-14 Thread Andrew Brookins
Hey, Yesterday I started seeing test runner failures with Django 1.2.1 and psycog2 2.4.2. Here's the traceback (where [project_dir] is the path to my virtualenv): Traceback (most recent call last): File "./manage.py", line 11, in execute_manager(settings) File "[p

Re: How to add CSRF to context when using test client???

2011-06-10 Thread Matteius
that I can pass a context which will add it in the CSRF. Otherwise there is not much of a point to enable CSRF with the test client because you'll get 403 errors. -Matt On Jun 10, 1:46 am, Artemenko Alexander <sa...@svetlyak.ru> wrote: > Hi Matt, > > Use: > > from djan

Re: How to add CSRF to context when using test client???

2011-06-10 Thread Artemenko Alexander
and I want to leave CSRF > checks enabled in testing.  This means on my POST I am getting 403 > because I have not figured out how to add csrf to my context when > using the test client.  Please advise on how to most easily do this: > > # Issue a POST request. >   

How to add CSRF to context when using test client???

2011-06-09 Thread Matteius
Greetings, I am writing unit tests for my application, and I want to leave CSRF checks enabled in testing. This means on my POST I am getting 403 because I have not figured out how to add csrf to my context when using the test client. Please advise on how to most easily do

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-04 Thread Javier Guerra Giraldez
On Sat, Jun 4, 2011 at 12:29 AM, AJ wrote: > My application does require emailing users and members of the website. This > is mostly system mail and users will not email amongst themselves. on webapp servers i usually install ssmtp. it's not for handling user's email, nor

Re: save out a test database?

2011-06-04 Thread Margie Roginski
At the time I asked the question I just had the sense that I wanted to debug an issue by bringing up the web interface midway through my test. I attempted to do things like stop midway through the test via set_trace() and then ctrl-c, then look at the db from a runserver run that was pointing

Re: Aw: Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-04 Thread ApogeeGMail
+1 for Webfaction On Jun 4, 2011, at 4:48 AM, Martin Brochhaus wrote: > +1 > > Hosting 20 (or more) on Webfaction. Awesome service. Awesome speed. Peace of > mind. > > Best regards, > Martin > > -- > You received this message because you are subscribed to the Google Groups > "Django users"

Re: save out a test database?

2011-06-04 Thread Karen Tracey
nd it!), > can you confirm that something like this is the best way to go? It > seems strange to me that there is no more standard way of dumping the > database from inside a test so that the state can be replicated for > use in a runserver environment. > > Well, usually you want t

Aw: Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-04 Thread Martin Brochhaus
+1 Hosting 20 (or more) on Webfaction. Awesome service. Awesome speed. Peace of mind. Best regards, Martin -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Kenneth Gonsalves
On Sat, 2011-06-04 at 01:29 -0400, AJ wrote: > I think I will go for VPS. I do agree that managing seems a little > work but > I guess eventually it will prove to be good. > > I have one more question: Is it easy to have the mail server setup on > a VPS? > My application does require emailing

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
I think I will go for VPS. I do agree that managing seems a little work but I guess eventually it will prove to be good. I have one more question: Is it easy to have the mail server setup on a VPS? My application does require emailing users and members of the website. This is mostly system mail

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Kenneth Gonsalves
On Fri, 2011-06-03 at 14:12 -0400, AJ wrote: > To change the question or ask a new one too: what name do you suggest > as a > good, reliable yet economical hosting provider - Both for personal > static > website hosting and little Django web projects? webfaction -- regards KG

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Dave Sayer
On 3 June 2011 19:48, Javier Guerra Giraldez wrote: > small VPSs tend to be the best answer if you don't mind adminstering > your own box.  both webfaction and linode have solid reputation and > support teams. > +1 for VPS. I had always used Dreamhost for hosting PHP & static

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Oscar Carballal
I recently discovered AlienLayer, a VPS provider in las vegas, they hace a $19/year plan that is quite good for personal stuff. Take a look to it :) Enviado desde mi HTC El 03/06/2011 20:48, "Javier Guerra Giraldez" escribió: > On Fri, Jun 3, 2011 at 1:12 PM, AJ

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Cal Leeming [Simplicity Media Ltd]
e('\\',"/") > > If you need your dev/prod to use the same database source, you can also use > middleware and db routers to control how much damage dev can cause etc. > > Cal > > On Fri, Jun 3, 2011 at 9:50 PM, AJ <brandmys...@gmail.com> wrote: > >> Well even

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Cal Leeming [Simplicity Media Ltd]
your dev/prod to use the same database source, you can also use middleware and db routers to control how much damage dev can cause etc. Cal On Fri, Jun 3, 2011 at 9:50 PM, AJ <brandmys...@gmail.com> wrote: > Well even if I do my Python stuff in virtualenv for development on a linode

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Shawn Milochik
On 06/03/2011 04:50 PM, AJ wrote: Well even if I do my Python stuff in virtualenv for development on a linode box, I'd like to know how to separate development/test environment to live/production. Is the only solution "/...//IP whitelisting to block only those who you want to have a

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
Well even if I do my Python stuff in virtualenv for development on a linode box, I'd like to know how to separate development/test environment to live/production. Is the only solution "*...**IP whitelisting to block only those who you want to have access...*"? Also, can I run multiple

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Shawn Milochik
On 06/03/2011 04:16 PM, Amanjeev Sethi wrote: Linode looks nice plus it will teach me some administration side too. If I try using linode, what is the best setup (Linux Distro, web server support, modules like mod_wsgi? etc ) for Django websites on linode? Use whatever distro you like

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Amanjeev Sethi
Linode looks nice plus it will teach me some administration side too. If I try using linode, what is the best setup (Linux Distro, web server support, modules like mod_wsgi? etc ) for Django websites on linode? On Fri, Jun 3, 2011 at 2:48 PM, Javier Guerra Giraldez wrote:

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Javier Guerra Giraldez
On Fri, Jun 3, 2011 at 1:12 PM, AJ wrote: > To change the question or ask a new one too: what name do you suggest as a > good, reliable yet economical hosting provider - Both for personal static > website hosting and little Django web projects? small VPSs tend to be the

Re: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
nto the virtual host config. > > Cal > > -- Forwarded message -- > From: AJ <brandmys...@gmail.com> > Date: Fri, Jun 3, 2011 at 7:01 PM > Subject: Setting up dev/test/production environments on the server > (dreamhost) > To: django-users@googlegroups.com >

Fwd: Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread Cal Leeming [Simplicity Media Ltd]
whitelisting to block only those who you want to have access, by adding a rejection rule directly into the virtual host config. Cal -- Forwarded message -- From: AJ <brandmys...@gmail.com> Date: Fri, Jun 3, 2011 at 7:01 PM Subject: Setting up dev/test/production enviro

Setting up dev/test/production environments on the server (dreamhost)

2011-06-03 Thread AJ
Happy Friday to All: I have a project under way. All this time I have been developing on my personal Macbook with Django's dev server. I'd like to push this to the hosting service I have from Dreamhost and test, develop, fix it there. I'd like to know how can I avoid it being visible only to me

Re: save out a test database?

2011-06-03 Thread Steve Bywater
What I've done to do this is insert a pdb.set_trace() right before the place your test fails, then in pdb do Ctrl+C to break out of the test. This leaves your test database intact at that state. Then you can change your settings to point to the test database instead of your regular one. Then you

Re: save out a test database?

2011-06-02 Thread Margie Roginski
that there is no more standard way of dumping the database from inside a test so that the state can be replicated for use in a runserver environment. Margie On Jun 1, 2:01 pm, Kirill Spitsin <t...@0x746e.org.ua> wrote: > On Wed, Jun 01, 2011 at 11:59:28AM -0700, Margie Roginski wrote: > >

Re: spawning threads within test cases in django test framework

2011-06-01 Thread Brian
Thanks for the replies. I realised that I could reorganise the code so that all the database updating was done in the main thread. Re TransactionTestCases, I knew I'd read something related to that but didn't find it when I went looking yesterday evening; it sounds like that would have worked

Re: spawning threads within test cases in django test framework

2011-06-01 Thread Kirill Spitsin
On Tue, May 31, 2011 at 02:01:00PM -0700, Brian wrote: > I've got a django app with a periodically scheduled background task that > updates the database. I've written a bunch of tests for its principal class > that are run as part of the django unit test framework. I want to convert &g

Re: save out a test database?

2011-06-01 Thread Kirill Spitsin
On Wed, Jun 01, 2011 at 11:59:28AM -0700, Margie Roginski wrote: > That's a good pointer, thanks. However I'm still confused about how I > can actually dump out the data from my test run? For example, say I > have a particular test and I want to dump the data at some certain > point

Re: spawning threads within test cases in django test framework

2011-06-01 Thread Duane Griffin
On 31 May 2011 22:01, Brian <brian.mcg...@gmail.com> wrote: > I've got a django app with a periodically scheduled background task that > updates the database. I've written a bunch of tests for its principal class > that are run as part of the django unit test framework. I

Re: save out a test database?

2011-06-01 Thread Margie Roginski
That's a good pointer, thanks. However I'm still confused about how I can actually dump out the data from my test run? For example, say I have a particular test and I want to dump the data at some certain point. I can put in pdb.set_trace() in the code to stop at the appropriate point, but what

spawning threads within test cases in django test framework

2011-05-31 Thread Brian
I've got a django app with a periodically scheduled background task that updates the database. I've written a bunch of tests for its principal class that are run as part of the django unit test framework. I want to convert the class to do its work using multiple threads, but I'm having trouble

Re: save out a test database?

2011-05-29 Thread Jason Culverhouse
On May 29, 2011, at 7:13 PM, Margie Roginski <margierogin...@yahoo.com> wrote: > Anyone know if there is a way to save out a test database that is > created through the django TestCase module? > I think this gets you close: https://docs.djangoproject.com/en/1.2/ref/django-ad

save out a test database?

2011-05-29 Thread Margie Roginski
Anyone know if there is a way to save out a test database that is created through the django TestCase module? IE, say I have a test that runs part way through. I'd like to save it out and then modify my settings.py to refer to the saved out test database and take a look at it via my web client

Re: how to get the test runner to only rebuild & populate the test_database if it changed?

2011-05-11 Thread Phlip
> Me again. Still helping clients TDD despite obese databases. [localhost] run: python manage.py test --settings=test_settings my_app --verbosity=0 -- Ran 2 tests in 0.018s OK Eat my vapor trail, b-words! Here's how I

how to get the test runner to only rebuild & populate the test_database if it changed?

2011-05-11 Thread Phlip
Djangoists: Me again. Still helping clients TDD despite obese databases. Right now the test suite takes a minute to build a database with >20 models (and lots of fields in each one), then load a mere 7,000 records. Yes I will cut down on the records, but building the database, in sqlite3 :mem

Re: Can't Test Apps Without Models?

2011-05-09 Thread Maksymus007
just create empty models,py file in your app folder. I don't know why,but thats how Django 'sees' your applications. Pozdrawiam, Maksymilian Pawlak 09-05-2011 23:58 użytkownik "protonpopsicle" <smeisbur...@gmail.com> napisał: > Is this a bug? > > If I run my unittest wit

Re: Can't Test Apps Without Models?

2011-05-09 Thread Boštjan Mejak
You must create a tests.py file in your project's directory. Have your tests in that file. I am not sure on that one, but try. -- 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.

Can't Test Apps Without Models?

2011-05-09 Thread protonpopsicle
Is this a bug? If I run my unittest with './manage.py test myapp' and myapp does not contain a models.py file, the following error results: django.core.exceptions.ImproperlyConfigured: App with label fogbugz could not be found This error does not describe the problem. Also, shouldn't one

Re: can't create test (secondary) database

2011-04-29 Thread Javier Guerra Giraldez
e the engine of the oracle database, turning to SQLite during test. unfortunately, since my legacy models have a managed=False setting, they're not created in the test database. for now, i added some preparation code that overrides that setting, to ensure that all the tables are created for testing.

Re: Best way to tell if we're in a test

2011-04-29 Thread Jody McIntyre
to use it every time you run self.client.login() or post to the login URL in a test case. That's probably why django-digest and django-bcrypt disable themselves under test (by default) and why I'd like to do it for security questions. Cheers, Jody On Fri, Apr 29, 2011 at 2:03 PM, Chris Czub

Re: can't create test (secondary) database

2011-04-29 Thread Shawn Milochik
You can specify the test database info (db, name, and password) for each database defined in settings, if you're using 1.2 or greater. http://docs.djangoproject.com/en/1.3/ref/settings/#databases This doesn't help if the same host is being used, but you can get around this by creating

can't create test (secondary) database

2011-04-29 Thread Javier Guerra Giraldez
). Of course, when i want to run the tests, i get an "error creating the test database: ORA-01031: insufficient privileges" message. i guess any of these (in decreasing order of preference) would be a solution, but i don't know how to do any of them. (well, maybe the last one could be don

Re: Best way to tell if we're in a test

2011-04-29 Thread Chris Czub
I think you might be taking the wrong approach. Rather than having your application code checking whether or not it's in a test, have your testing code disable/mock certain behaviors that you don't want exercised(like have it always return that the user answered the security question correctly

Best way to tell if we're in a test

2011-04-29 Thread Jody McIntyre
What's the best way to tell (from regular code) if we're in a test? I have added extra authentication steps (security questions) that would be difficult to deal with in tests where you just want to run self.client.login() or post to the login URL. I've noticed that several third party

Re: authentication not working using test client

2011-04-26 Thread Roy Smith
= ( 'django.contrib.auth.backends.ModelBackend', 'socialregistration.auth.FacebookAuth', ) On Apr 26, 2011, at 12:56 PM, Roy Smith wrote: > I've got a test case that essentially looks like this: > > -- > from django

authentication not working using test client

2011-04-26 Thread Roy Smith
I've got a test case that essentially looks like this: -- from django.test import TestCase from django.test.client import Client from django.contrib.auth.models import User class ApiTest(TestCase): def test_login

Models within Imported TestCases not created in Test Database...

2011-04-17 Thread Bob Carr
Hi All, Why don't models within tests imported into app/tests.py get picked up during test database creation. from django.db import models from django.test import TestCase # This test defined in app/tests.py works fine... class test_TestModel(TestCase): class TestModel(models.Model

Re: How to unit test if user has access to page

2011-04-17 Thread Pedro Kroger
Good point. Thank you guys! Pedro On Sat, Apr 16, 2011 at 2:15 PM, Martin Brochhaus <martin.brochh...@googlemail.com> wrote: > Also beware! Only do a client.post if you really want to test that a user > submits a form. Usually when a not-logged-in-user wants to go to a secured > p

Re: Test fails to run

2011-04-16 Thread gladys
Hi, In which part of the test are you truncating the db? It could also be that test_ db is still in your database after a previous run of test, and it refuses to flush. Try manually deleting it and running syncdb again. -- Gladys http://blog.bixly.com On Apr 17, 1:20 am, Aleksandr

Test fails to run

2011-04-16 Thread Aleksandr Vladimirskiy
Hello, I'm running a test but it fails after syncdb part with the following message: Error: Database test_ couldn't be flushed. Possible reasons: * The database isn't running or isn't configured correctly. * At least one of the expected database tables doesn't exist. * The SQL was invalid

Aw: How to unit test if user has access to page

2011-04-16 Thread Martin Brochhaus
Also beware! Only do a client.post if you really want to test that a user submits a form. Usually when a not-logged-in-user wants to go to a secured page immediately he will try a get request and just enter the URL. Sometimes your view behaves differently on get and on post (most of the times

Re: How to unit test if user has access to page

2011-04-15 Thread Javier Guerra Giraldez
On Fri, Apr 15, 2011 at 8:54 PM, Pedro Kroger <pedro.kro...@gmail.com> wrote: > result = self.client.post('/dashboard/') > > But I don't know how to test if the result is the dashboard or the > login page. Could you guys point me in the right direction? fr

How to unit test if user has access to page

2011-04-15 Thread Pedro Kroger
Hi, I writing some unit tests and I'd like to test if an unlogged user has access to the main dashboard page. In my application, if the user is logged it will go to the dashboard, if it isn't, it will go to the login page. I know how to get to the webpage: result = self.client.post('/dashboard

Re: Unit test successful in isolation, fails when the whole app is tested

2011-04-08 Thread Evgeny
Thanks, Karen. The specifics are: * when the test is run as "python manage.py test askbot" - all tests from this suite fail (there are two, only one shown for brevity) and the remaining 400 or so tests pass * the nature of failure - there are 0 email in the outbox (with on

Re: Unit test successful in isolation, fails when the whole app is tested

2011-04-08 Thread Karen Tracey
On Thu, Apr 7, 2011 at 11:21 PM, Evgeny <evgeny.fad...@gmail.com> wrote: > > I have one test suite (among many others) in my application that > succeeds in isolation, but fails > when I run the whole battery. Could anyone suggest where to start > looking? Start with the spe

Unit test successful in isolation, fails when the whole app is tested

2011-04-07 Thread Evgeny
Hello, I have one test suite (among many others) in my application that succeeds in isolation, but fails when I run the whole battery. Could anyone suggest where to start looking? Thanks. Posting the code below. The test is counting number of emails sent as a result of posting a question

Issues with post_save signals on test execution?

2011-03-31 Thread rikuthero...@gmail.com
Hi, After migrate an application from Django 1.1 to Django 1.3 I noticed that some unittest was failing. Debugging I get to the point that the post_save functions didn't execute on test running. If I see the receivers on the test execution: ipdb> from django.db.models import signals i

Re: my assertRases test does not call the clean() method

2011-03-17 Thread Kenneth Gonsalves
rs/#how-validators-are-run): > > "Note that validators will not be run automatically when you save a > model". > > In order to test model validation, you should create the model > instance and > then call instance.full_clean() on it. thanks - works now. -- regard

Re: my assertRases test does not call the clean() method

2011-03-17 Thread Daniel Roseman
On Thursday, March 17, 2011 9:47:50 AM UTC, lawgon wrote: > > hi, > > I have a test like this: > > > self.assertRaises(ValidationError,Costtocompany.objects.create,profile=self.profile1, > company_laptop = True, >

my assertRases test does not call the clean() method

2011-03-17 Thread Kenneth Gonsalves
hi, I have a test like this: self.assertRaises(ValidationError,Costtocompany.objects.create,profile=self.profile1, company_laptop = True, ctc_pa=1, ctc_pm =1

Tests with test specific models

2011-03-14 Thread Mike Ramirez
Example: I have an app that uses ContentType and I want to test that against an arbitrary model to make sure that the usage of ContentType is correct. Ex: In my app.models I have: class Rating(models.Model): total = models.DecimalField(default=0, decimal_places=2, max_digits=8) score

Re: How do I run test and get results programmatically? (django, south, fixtures, sqlite)

2011-03-14 Thread Jumpfroggy
for every migration - during prod and testing. This is bad. So I went with "SOUTH_TESTS_MIGRATE = False", then I manually load the "test_data" fixture during the first test. Works great. I still can't figure out why running "python manage.py test" and running the above co

Re: test cannot find assertContains

2011-03-14 Thread Mike Ramirez
On Sunday, March 13, 2011 10:58:10 pm Kenneth Gonsalves wrote: > On Sun, 2011-03-13 at 22:40 -0700, Mike Ramirez wrote: > > > I know it is there - but it is half way down the page. My point is > > > > that > > > > > it should be at the top of the page. For what it's worth I filed a > > > ticket.

Re: test cannot find assertContains

2011-03-13 Thread Mike Ramirez
On Sunday, March 13, 2011 10:40:51 pm you wrote: > With this all in mind, I think they do enough to say use 'django.testing', > without having it specifically marked at the start. > > But it could possibly benefit from being two pages, one an "overview" and > one page for "django.testing" > > >

Re: test cannot find assertContains

2011-03-13 Thread Kenneth Gonsalves
On Sun, 2011-03-13 at 22:40 -0700, Mike Ramirez wrote: > > I know it is there - but it is half way down the page. My point is > that > > it should be at the top of the page. For what it's worth I filed a > > ticket. > > I've een wondering about this myself, but I'm not sure that it's in > the

Re: test cannot find assertContains

2011-03-13 Thread Mike Ramirez
tests.py """ This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". Replace this with more appropriate tests for your application. """ from django.test import TestCase class

Re: test cannot find assertContains

2011-03-13 Thread Kenneth Gonsalves
On Sat, 2011-03-12 at 00:12 -0800, Mike Ramirez wrote: > On Friday, March 11, 2011 11:37:38 pm Kenneth Gonsalves wrote: > > > and all is well. I think the dev docs need to be clearer on this > point > > and mention this at the outset. After all they *are* dev docs. > >

Re: How do I run test and get results programmatically? (django, south, fixtures, sqlite)

2011-03-13 Thread gladys
I'm not sure if this is what you need, but if the problem is with the migrations not being run, you can specify a setting in your settings.py to use syncdb when running tests. #settings.py SOUTH_TESTS_MIGRATE = False # make test database created using syncdb rather than migrations Goodluck

Re: test cannot find assertContains

2011-03-12 Thread werefr0g
Hi, As far I can tell from the documentation, to use Django's extended TestCase, you should use django.test.TestCase [1]. Using django.utils.unittest allows you to benefit from python 2.7 unittest2 library, [2] Regards, [1]

Re: test cannot find assertContains

2011-03-12 Thread Mike Ramirez
On Friday, March 11, 2011 11:37:38 pm Kenneth Gonsalves wrote: > and all is well. I think the dev docs need to be clearer on this point > and mention this at the outset. After all they *are* dev docs. http://docs.djangoproject.com/en/1.2/topics/testing/#testcase Mike -- Would that my hand

Re: test cannot find assertContains

2011-03-11 Thread Kenneth Gonsalves
On Fri, 2011-03-11 at 23:23 -0800, Mike Ramirez wrote: > On Friday, March 11, 2011 11:21:02 pm you wrote: > > The problem here is that assertContains is not part of > unittest/unittest2. > > > > It's defined in TransactionTestCase in django.test, which extends > > unittest2.TestCase and adds in

Re: test cannot find assertContains

2011-03-11 Thread Mike Ramirez
On Friday, March 11, 2011 11:21:02 pm you wrote: > The problem here is that assertContains is not part of unittest/unittest2. > > It's defined in TransactionTestCase in django.test, which extends > unittest2.TestCase and adds in assertContains, assertNotContains, > assetFormError, basically

Re: test cannot find assertContains

2011-03-11 Thread Mike Ramirez
On Friday, March 11, 2011 11:11:21 pm Kenneth Gonsalves wrote: > On Fri, 2011-03-11 at 23:04 -0800, Mike Ramirez wrote: > > > from django.utils import unittest > > > > from django.test import TestCase > > > > the stuff in utils.unittest is unittest2 stuff if you're using python > > <2.7 > >

Re: test cannot find assertContains

2011-03-11 Thread Kenneth Gonsalves
On Fri, 2011-03-11 at 23:04 -0800, Mike Ramirez wrote: > > > > from django.utils import unittest > > from django.test import TestCase > > the stuff in utils.unittest is unittest2 stuff if you're using python > <2.7 > (unittest2 is part of 2.7 now as unittest). I am using 2.6, but according

Re: test cannot find assertContains

2011-03-11 Thread Mike Ramirez
On Friday, March 11, 2011 11:04:39 pm Mike Ramirez wrote: > assertContains is a django specific test and located in test.TestCase with > the others (you can find TransactionTestCase in there also). > I should also add, TransactionTestCase is the base for TestCase and TestCase is reall

Re: test cannot find assertContains

2011-03-11 Thread Mike Ramirez
On Friday, March 11, 2011 10:19:27 pm Kenneth Gonsalves wrote: > hi, > > I am trying to run a test using assertContains, but get this error: > > AttributeError: 'SourceTestCase' object has no attribute > 'assertContains' > > my code: > > from django.utils imp

test cannot find assertContains

2011-03-11 Thread Kenneth Gonsalves
hi, I am trying to run a test using assertContains, but get this error: AttributeError: 'SourceTestCase' object has no attribute 'assertContains' my code: from django.utils import unittest from incident.models import Source from django.test.client import Client class SourceTestCase

How do I run test and get results programmatically? (django, south, fixtures, sqlite)

2011-03-11 Thread Jumpfroggy
I have an app that I'm starting to write tests for. The app uses south for all migrations and mysql for the db. I wrote some tests and also created an initial_data.json fixture to provide some default data. If I run "python manage.py test", the database is created via sqlite, the tes

BDD test scenario localisation

2011-02-07 Thread Sultan Imanhodjaev
Hello, I was wondering if there any way to localise BDD test according to project requirement is there any issue? Sultan -- 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@google

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