mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-27 10:18:12 +00:00
Add tests for Location.with_timestamp
This commit is contained in:
parent
16c49d177b
commit
3644bd14dc
1 changed files with 8 additions and 0 deletions
|
@ -189,6 +189,10 @@ def test_user_parsing(self):
|
||||||
assert repr(Location('ssh://host/path::2016-12-31@23:59:59')) == \
|
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')"
|
"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):
|
def test_underspecified(self, monkeypatch):
|
||||||
monkeypatch.delenv('BORG_REPO', raising=False)
|
monkeypatch.delenv('BORG_REPO', raising=False)
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
|
@ -935,6 +939,10 @@ def test_replace_placeholders():
|
||||||
assert int(replace_placeholders('{now:%Y}')) == now.year
|
assert int(replace_placeholders('{now:%Y}')) == now.year
|
||||||
|
|
||||||
|
|
||||||
|
def test_override_placeholders():
|
||||||
|
assert replace_placeholders('{uuid4}', overrides={'uuid4': "overridden"}) == "overridden"
|
||||||
|
|
||||||
|
|
||||||
def working_swidth():
|
def working_swidth():
|
||||||
return platform.swidth('선') == 2
|
return platform.swidth('선') == 2
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue