def testDefaultSettingOfOnePlayack(self): """Ensure that we play back only one time""" policy = FixedCountPolicy() self.failIf(policy.hasBeenPlayedBack) self.failIf(policy.isReadyForRemoval) policy.playback() self.failUnless(policy.hasBeenPlayedBack) self.failUnless(policy.isReadyForRemoval)
def testSettingCountsCorrectlyPlaysBack(self): """Setting the playback count works""" policy = FixedCountPolicy(2) for x in [1, 2]: self.failIf(policy.hasBeenPlayedBack) self.failIf(policy.isReadyForRemoval) policy.playback() self.failUnless(policy.hasBeenPlayedBack) self.failUnless(policy.isReadyForRemoval)
def testTooManyPlaybacksRaisesAnException(self): """Too many playback raises an exception""" policy = FixedCountPolicy() policy.playback() self.failUnlessRaises(RecordedCallsWereNotReplayedCorrectly, policy.playback)