mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-03-11 14:53:55 +00:00
Merge pull request #453 from meejah/magic-folder-test-time
use '5 years ago' instead of absolute timestamp
This commit is contained in:
commit
c351a1d327
@ -3,6 +3,8 @@ import shutil
|
|||||||
import os.path
|
import os.path
|
||||||
import mock
|
import mock
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from twisted.trial import unittest
|
from twisted.trial import unittest
|
||||||
from twisted.internet import defer
|
from twisted.internet import defer
|
||||||
@ -293,6 +295,10 @@ class StatusMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_status(self):
|
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):
|
def json_for_cap(options, cap):
|
||||||
if cap.startswith('URI:DIR2:'):
|
if cap.startswith('URI:DIR2:'):
|
||||||
return (
|
return (
|
||||||
@ -303,7 +309,7 @@ class StatusMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
|
|||||||
"size": 1234,
|
"size": 1234,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tahoe": {
|
"tahoe": {
|
||||||
"linkcrtime": 0.0,
|
"linkcrtime": (time.time() - five_year_interval),
|
||||||
},
|
},
|
||||||
"version": 1,
|
"version": 1,
|
||||||
},
|
},
|
||||||
@ -332,7 +338,7 @@ class StatusMagicFolder(MagicFolderCLITestMixin, unittest.TestCase):
|
|||||||
self.assertIn("default", stdout)
|
self.assertIn("default", stdout)
|
||||||
|
|
||||||
self.assertIn(
|
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,
|
stdout,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user