Changes between Initial Version and Version 2 of Ticket #29303


Ignore:
Timestamp:
Apr 10, 2018, 1:57:15 PM (7 years ago)
Author:
Alasdair Nicol
Comment:

Sorry, there was a mistake in the wrapped_view line, I didn't apply it to the view. It should be:

wrapped_view = transaction.non_atomic_requests(using='other')(my_view)

I've updated the example in the ticket description.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29303 – Description

    initial v2  
    44
    55{{{
     6from django.test import TestCase
     7
     8# Create your tests here.
     9
     10from django.test import TestCase
    611from django.db import transaction
    712
    813@transaction.non_atomic_requests(using='default')
    914def my_view(request):
    10     return HttpResponse('')
     15        return HttpResponse('')
    1116
    12 assert my_view._non_atomic_requests == {'default'}  # passes
     17class TestViews(TestCase):
    1318
    14 wrapped_view = transaction.non_atomic_requests(using='other')
     19    def test(self):
     20        assert my_view._non_atomic_requests == {'default'}  # passes
    1521
    16 assert wrapped_view._non_atomic_requests == {'default', 'other'}  # passes
    17 assert my_view._non_atomic_requests == {'default'}  # fails
     22        wrapped_view = transaction.non_atomic_requests(using='other')(my_view)
     23
     24        assert wrapped_view._non_atomic_requests == {'default', 'other'}  # passes
     25        assert my_view._non_atomic_requests == {'default'}  # fails
    1826}}}
    1927
Back to Top