コード例 #1
0
ファイル: tests.py プロジェクト: rtpg/junkcode
    def test_price_data_too_old(self):
        downloader = SpotPriceDownloader()
        open('fake_file.pkl', 'a').close()

        oldtime = arrow.utcnow().replace(hours=-5).timestamp
        newtime = arrow.utcnow().timestamp

        os.utime('fake_file.pkl',(oldtime,oldtime))
        self.assertTrue(downloader._price_data_is_old(filename='fake_file.pkl'))

        os.utime('fake_file.pkl',(newtime,newtime))
        self.assertFalse(downloader._price_data_is_old(filename='fake_file.pkl'))