Given a backend of postgres and a simple test to test that, for example, your model does not accept fields with more characters than it should ... how do you do it?
I have a part database which has two fields - code and description. e.g. class Part(models.Model): code = models.CharField(max_length=15) description = models.CharField(max_length=50) I want to make sure that a code field can't have more than 15 chars. Even if I just greedily swallow the exception:: def testPartCodeBad(self): """Reject our bad code""" part = Part() part.code = '1234567890123456' part.description = 'AAAAAA' try: part.save() except: pass I still end up with Destroying old test database... Creating test database... Creating table auth_permission Creating table auth_group Creating table auth_user Creating table auth_message Creating table django_content_type Creating table django_session Creating table django_site Creating table django_admin_log Creating table stock_part Installing index for auth.Permission model Installing index for auth.Message model Installing index for admin.LogEntry model .Error: Database test_taiko 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. Hint: Look at the output of 'django-admin.py sqlflush'. That's the SQL this command wasn't able to run. The full error: current transaction is aborted, commands ignored until end of transaction block What it actually means is, you stuck 16 chars where only 15 chars were allowed. Is this testable? Ian --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---