コード例 #1
0
 def test_before_request_transaction_active(self):
     commands.begin()
     transactions_before = database.command('showLiveTransactions')
     handlers.transaction_before_request()
     transactions = database.command('showLiveTransactions')
     assert_equal(len(transactions['transactions']), 1)
     assert_not_equal(
         transactions_before['transactions'][0]['txnid'],
         transactions['transactions'][0]['txnid'],
     )
コード例 #2
0
 def test_before_request_transaction_active(self):
     commands.begin()
     transactions_before = database.command('showLiveTransactions')
     handlers.transaction_before_request()
     transactions = database.command('showLiveTransactions')
     assert_equal(len(transactions['transactions']), 1)
     assert_not_equal(
         transactions_before['transactions'][0]['txnid'],
         transactions['transactions'][0]['txnid'],
     )
コード例 #3
0
ファイル: middleware.py プロジェクト: fredtoh/osf.io
 def process_request(self, request):
     """Begin a transaction if one doesn't already exist."""
     transaction_before_request()
コード例 #4
0
 def process_request(self, request):
     """Begin a transaction if one doesn't already exist."""
     transaction_before_request()
コード例 #5
0
 def test_before_request_unexpected_error(self, mock_rollback):
     mock_rollback.side_effect = OperationFailure('daamn!')
     with assert_raises(OperationFailure):
         handlers.transaction_before_request()
コード例 #6
0
 def test_before_request(self):
     handlers.transaction_before_request()
     transactions = database.command('showLiveTransactions')
     assert_equal(len(transactions['transactions']), 1)
コード例 #7
0
 def test_before_request_unexpected_error(self, mock_rollback):
     mock_rollback.side_effect = OperationFailure('daamn!')
     with assert_raises(OperationFailure):
         handlers.transaction_before_request()
コード例 #8
0
 def test_before_request(self):
     handlers.transaction_before_request()
     transactions = database.command('showLiveTransactions')
     assert_equal(len(transactions['transactions']), 1)