def testForceLock(self): self.mox.StubOutClassWithMocks(lock, 'PidFile') mock_lock = lock.PidFile(filename=None) mock_lock.Lock(force=True).AndReturn('LOCK') self.mox.ReplayAll() c = command.Command() self.assertEquals('LOCK', c._Lock(force=True))
def testUnlock(self): self.mox.StubOutClassWithMocks(lock, 'PidFile') mock_lock = lock.PidFile(filename=None) mock_lock.Lock(force=False).AndReturn(True) mock_lock.Locked().AndReturn(True) mock_lock.Unlock() mock_lock.Locked().AndReturn(False) # destructor self.mox.ReplayAll() c = command.Command() c._Lock() c._Unlock()
def testLock(self): self.mox.StubOutClassWithMocks(lock, 'PidFile') mock_lock = lock.PidFile(filename=None) mock_lock.Lock(force=False).AndReturn('LOCK') mock_lock.Lock(force=False).AndReturn('MORLOCK') self.mox.ReplayAll() c = command.Command() # First test that we create a lock and lock it. self.assertEquals('LOCK', c._Lock()) # Then we test that we lock the existing one a second time. self.assertEquals('MORLOCK', c._Lock())
def testCommandHelp(self): c = command.Command() self.assertNotEqual(None, c) self.assertEqual(None, c.Help())
def testRunCommand(self): c = command.Command() self.assertRaises(NotImplementedError, c.Run, [], {})