from twisted.trial import unittest
import os, sets

from MailPing import fileutil

class TestFileUtil(unittest.TestCase):
    def testTimestampRead(self):
        filename = self.mktemp()
        f=file(filename, 'w')
        f.write('42\n')
        f.close()

        self.assertEquals(fileutil.getTime(filename), 42)

    def testTimestampReadFail(self):
        filename = self.mktemp()

        self.assertEquals(fileutil.getTime(filename), -1)
