1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 17:57:59 +00:00

Add tests for Location.with_timestamp

This commit is contained in:
Milkey Mouse 2020-11-02 16:04:49 -08:00
parent 16c49d177b
commit 3644bd14dc
No known key found for this signature in database
GPG key ID: C6EF5A02F5647987

View file

@ -189,6 +189,10 @@ def test_user_parsing(self):
assert repr(Location('ssh://host/path::2016-12-31@23:59:59')) == \
"Location(proto='ssh', user=None, host='host', port=None, path='/path', archive='2016-12-31@23:59:59')"
def test_with_timestamp(self):
assert repr(Location('path::archive-{utcnow}').with_timestamp(datetime(2002, 9, 19))) == \
"Location(proto='file', user=None, host=None, port=None, path='path', archive='archive-2002-09-19T00:00:00')"
def test_underspecified(self, monkeypatch):
monkeypatch.delenv('BORG_REPO', raising=False)
with pytest.raises(ValueError):
@ -935,6 +939,10 @@ def test_replace_placeholders():
assert int(replace_placeholders('{now:%Y}')) == now.year
def test_override_placeholders():
assert replace_placeholders('{uuid4}', overrides={'uuid4': "overridden"}) == "overridden"
def working_swidth():
return platform.swidth('') == 2