lukebpotato/djangae-testapp — pull request #2 by igniteflow (2014-07-10 13:35:54+00:00)
Title: Add test to reproduce model_formset error

Raises an IntegrityError instead, I may have missed something obvious here.

To run the test:

```
pip install -r requirements.txt
./manage.py test testapp.tests:ModelFormsetTest
```

Output:

```
[igniteflow:~/Projects/djangae-testapp] [djangae] master 2s ± ./manage.py test testapp.tests:ModelFormsetTest
INFO 2014-07-10 14:34:47,061 api_server.py:171] Starting API server at: http://localhost:36200
nosetests testapp.tests:ModelFormsetTest --logging-clear-handlers --verbosity=1
Creating test database for alias 'default'...
FE
======================================================================
ERROR: test_reproduce_index_error (testapp.tests.ModelFormsetTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/test/testcases.py", line 268, in __call__
self._post_teardown()
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/test/testcases.py", line 533, in _post_teardown
self._fixture_teardown()
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/test/testcases.py", line 865, in _fixture_teardown
return super(TestCase, self)._fixture_teardown()
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/test/testcases.py", line 553, in _fixture_teardown
skip_validation=True, reset_sequences=False)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/core/management/__init__.py", line 161, in call_command
return klass.execute(*args, **defaults)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/core/management/base.py", line 255, in execute
output = self.handle(*args, **options)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/core/management/base.py", line 385, in handle
return self.handle_noargs(**options)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/core/management/commands/flush.py", line 82, in handle_noargs
emit_post_sync_signal(set(all_models), verbosity, interactive, db)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/core/management/sql.py", line 195, in emit_post_sync_signal
interactive=interactive, db=db)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/dispatch/dispatcher.py", line 170, in send
response = receiver(signal=self, sender=sender, **named)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/contrib/contenttypes/management.py", line 48, in update_contenttypes
ContentType.objects.using(db).bulk_create(cts)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/db/models/query.py", line 458, in bulk_create
self._batched_insert(objs_without_pk, fields, batch_size)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/db/models/query.py", line 916, in _batched_insert
using=self.db)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/db/models/manager.py", line 215, in _insert
return insert_query(self.model, objs, fields, **kwargs)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/db/models/query.py", line 1675, in insert_query
return query.get_compiler(using=using).execute_sql(return_id)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/lib/django-1.5/django/db/models/sql/compiler.py", line 943, in execute_sql
cursor.execute(sql, params)
File "/home/igniteflow/Projects/djangae-testapp/lib/djangae/db/backends/appengine/base.py", line 90, in execute
self.returned_ids = sql.execute()
File "/home/igniteflow/Projects/djangae-testapp/lib/djangae/db/backends/appengine/commands.py", line 687, in execute
markers = constraints.acquire_bulk(self.model, self.entities)
File "/home/igniteflow/Projects/djangae-testapp/lib/djangae/db/constraints.py", line 89, in acquire_bulk
markers.append(acquire(model, entity))
File "/home/igniteflow/Projects/djangae-testapp/lib/djangae/db/constraints.py", line 104, in acquire
return acquire_identifiers(identifiers, entity.key())
File "/home/igniteflow/Projects/djangae-testapp/lib/djangae/db/constraints.py", line 51, in acquire_identifiers
markers.append(acquire_marker(identifier))
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/google/appengine/api/datastore.py", line 2722, in inner_wrapper
return RunInTransactionOptions(options, func, *args, **kwds)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/google/appengine/api/datastore.py", line 2620, in RunInTransactionOptions
ok, result = _DoOneTry(function, args, kwargs)
File "/home/igniteflow/Projects/djangae-testapp/lib/google_appengine/google/appengine/api/datastore.py", line 2640, in _DoOneTry
result = function(*args, **kwargs)
File "/home/igniteflow/Projects/djangae-testapp/lib/djangae/db/constraints.py", line 35, in acquire_marker
raise IntegrityError()
IntegrityError

======================================================================
FAIL: test_reproduce_index_error (testapp.tests.ModelFormsetTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/igniteflow/Projects/djangae-testapp/testapp/django_form_tests/model_formset_tests.py", line 43, in test_reproduce_index_error
TestModelFormSet(request.POST, request.FILES)
AssertionError: IndexError not raised

----------------------------------------------------------------------
Ran 1 test in 0.079s

FAILED (errors=1, failures=1)
Destroying test database for alias 'default'...
```