Changes between Initial Version and Version 2 of Ticket #29303
- Timestamp:
- Apr 10, 2018, 1:57:15 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #29303 – Description
initial v2 4 4 5 5 {{{ 6 from django.test import TestCase 7 8 # Create your tests here. 9 10 from django.test import TestCase 6 11 from django.db import transaction 7 12 8 13 @transaction.non_atomic_requests(using='default') 9 14 def my_view(request): 10 return HttpResponse('')15 return HttpResponse('') 11 16 12 assert my_view._non_atomic_requests == {'default'} # passes 17 class TestViews(TestCase): 13 18 14 wrapped_view = transaction.non_atomic_requests(using='other') 19 def test(self): 20 assert my_view._non_atomic_requests == {'default'} # passes 15 21 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 18 26 }}} 19 27