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'))
def test_check_stamp_missing(self): with patch('os.path.exists', Mock(return_value=False)): self.assertFalse(util.check_stamp('foo.stamp', ''))