class RegistryTests(TestCase): def setUp(self): self.registry = Registry(mockSpecification) def test_roundtrip(self): def getTarget(): return self.registry["target"] self.assertRaises(KeyError, getTarget) self.assertIs(target, realTarget) self.registry.start() mock = getTarget() self.assertIs(mock, target) self.registry.stop() self.assertRaises(getTarget) self.assertIs(target, realTarget)
def test_passedSpecifcation(self): registry = Registry.forTestCase(self, {}) self.assertEqual(registry._patches, [])
def test_forTestCase(self): self.assertEqual(len(Registry.forTestCase(self)._patches), 1)
def setUp(self): self.registry = Registry(mockSpecification)