ranger/orm/tests/unit/common/test_transaction_id_hook.py
Nicholas Jones 20aa6dcdba Move all common tests to top level folder
Moves all tests under orm/common to the top level tests folder
and makes minimal necessary changes to get them working.

Change-Id: Ib813d130ac5a2b3e2205c3a0d9cbeff46359ced1
2017-08-15 08:21:09 -05:00

19 lines
592 B
Python
Executable File

import logging
from unittest import TestCase
import mock
from orm.common.orm_common.hooks import transaction_id_hook
logger = logging.getLogger(__name__)
class TestTransactionIdHook(TestCase):
@mock.patch.object(transaction_id_hook.utils, 'make_transid',
return_value='test')
def test_before_sanity(self, mock_make_transid):
t = transaction_id_hook.TransactionIdHook()
state = mock.MagicMock()
t.before(state)
self.assertEqual(state.request.transaction_id, 'test')
self.assertEqual(state.request.tracking_id, 'test')