Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'issue_23' into transaction-management
- Loading branch information
Showing
5 changed files
with
132 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
############################################################################## | ||
# | ||
# Copyright (c) 2010 Zope Foundation and Contributors. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE | ||
# | ||
############################################################################## | ||
|
||
from unittest import TestCase | ||
from unittest import TestSuite | ||
from unittest import makeSuite | ||
|
||
|
||
class TestTM(TestCase): | ||
|
||
def _getTargetClass(self): | ||
from ..THUNK import THUNKED_TM | ||
return THUNKED_TM | ||
|
||
def _makeOne(self): | ||
return self._getTargetClass()() | ||
|
||
def test_conformance(self): | ||
from transaction.interfaces import IDataManager | ||
from zope.interface.verify import verifyObject | ||
tm = self._makeOne() | ||
verifyObject(IDataManager, tm) | ||
|
||
def test__register(self): | ||
tm = self._makeOne() | ||
self.assertFalse(tm._registered) | ||
|
||
tm._register() | ||
self.assertTrue(tm._registered) | ||
|
||
# Registering again won't break anything | ||
tm._register() | ||
self.assertTrue(tm._registered) | ||
|
||
def test_sortKey(self): | ||
tm = self._makeOne() | ||
# the default Transaction Manager should have .sortKey() of '1' for | ||
# backward compatibility. It must be a string according to the | ||
# ITransactionManager interface. | ||
self.assertEqual(tm.sortKey(), '1') | ||
|
||
# but the sortKey() should be adjustable | ||
tm.setSortKey('2') | ||
self.assertEqual(tm.sortKey(), '2') | ||
|
||
tm.setSortKey([]) | ||
self.assertEqual(tm.sortKey(), '[]') | ||
|
||
|
||
def test_suite(): | ||
return TestSuite((makeSuite(TestTM),)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters