Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | # Copyright (C) 2007-2012 Michael Foord & the mock team |
michael@0 | 2 | # E-mail: fuzzyman AT voidspace DOT org DOT uk |
michael@0 | 3 | # http://www.voidspace.org.uk/python/mock/ |
michael@0 | 4 | |
michael@0 | 5 | from tests.support import unittest2 |
michael@0 | 6 | |
michael@0 | 7 | from mock import sentinel, DEFAULT |
michael@0 | 8 | |
michael@0 | 9 | |
michael@0 | 10 | class SentinelTest(unittest2.TestCase): |
michael@0 | 11 | |
michael@0 | 12 | def testSentinels(self): |
michael@0 | 13 | self.assertEqual(sentinel.whatever, sentinel.whatever, |
michael@0 | 14 | 'sentinel not stored') |
michael@0 | 15 | self.assertNotEqual(sentinel.whatever, sentinel.whateverelse, |
michael@0 | 16 | 'sentinel should be unique') |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | def testSentinelName(self): |
michael@0 | 20 | self.assertEqual(str(sentinel.whatever), 'sentinel.whatever', |
michael@0 | 21 | 'sentinel name incorrect') |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | def testDEFAULT(self): |
michael@0 | 25 | self.assertTrue(DEFAULT is sentinel.DEFAULT) |
michael@0 | 26 | |
michael@0 | 27 | def testBases(self): |
michael@0 | 28 | # If this doesn't raise an AttributeError then help(mock) is broken |
michael@0 | 29 | self.assertRaises(AttributeError, lambda: sentinel.__bases__) |
michael@0 | 30 | |
michael@0 | 31 | |
michael@0 | 32 | if __name__ == '__main__': |
michael@0 | 33 | unittest2.main() |