Merge pull request #453 from meejah/magic-folder-test-time

use '5 years ago' instead of absolute timestamp
This commit is contained in:
meejah 2018-01-03 15:41:32 -07:00 committed by GitHub
commit c351a1d327
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,8 @@ import shutil
import os.path
import mock
import re
import time
from datetime import datetime
from twisted.trial import unittest
from twisted.internet import defer
@ -293,6 +295,10 @@ class StatusMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
@defer.inlineCallbacks
def test_status(self):
now = datetime.now()
then = now.replace(year=now.year - 5)
five_year_interval = (now - then).total_seconds()
def json_for_cap(options, cap):
if cap.startswith('URI:DIR2:'):
return (
@ -303,7 +309,7 @@ class StatusMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
"size": 1234,
"metadata": {
"tahoe": {
"linkcrtime": 0.0,
"linkcrtime": (time.time() - five_year_interval),
},
"version": 1,
},
@ -332,7 +338,7 @@ class StatusMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
self.assertIn("default", stdout)
self.assertIn(
"foo (1.23 kB): good, version=1, created 47 years ago",
"foo (1.23 kB): good, version=1, created 5 years ago",
stdout,
)