示例#1
0
  def testSet(self):
    self.assertFalse(os.path.exists(self.filename))

    for i in range(10):
      backend.SetWatcherPause(i, _filename=self.filename)
      self.assertEqual(utils.ReadFile(self.filename), "%s\n" % i)
      self.assertEqual(os.stat(self.filename).st_mode & 0777, 0644)
示例#2
0
  def testSetNonNumeric(self):
    for i in ["", [], {}, "Hello World", "0", "1.0"]:
      self.assertFalse(os.path.exists(self.filename))

      try:
        backend.SetWatcherPause(i, _filename=self.filename)
      except backend.RPCFail, err:
        self.assertEqual(str(err), "Duration must be numeric")
      else:
        self.fail("Did not raise exception")

      self.assertFalse(os.path.exists(self.filename))
示例#3
0
    def perspective_set_watcher_pause(params):
        """Set watcher pause.

    """
        (until, ) = params
        return backend.SetWatcherPause(until)
示例#4
0
 def testUnsetNonExisting(self):
   self.assertFalse(os.path.exists(self.filename))
   backend.SetWatcherPause(None, _filename=self.filename)
   self.assertFalse(os.path.exists(self.filename))