예제 #1
0
  def test_check_stamp_contents(self):
    temp_fd, temp_name = tempfile.mkstemp('webports_test')
    self.addCleanup(os.remove, temp_name)

    stamp_contents = 'stamp file contents'
    with os.fdopen(temp_fd, 'w') as f:
      f.write(stamp_contents)

    self.assertTrue(util.check_stamp(temp_name, stamp_contents))
    self.assertFalse(util.check_stamp(temp_name, stamp_contents + 'x'))
예제 #2
0
 def test_check_stamp_missing(self):
   with patch('os.path.exists', Mock(return_value=False)):
     self.assertFalse(util.check_stamp('foo.stamp', ''))