mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Fix error when snapshot exists with an underscore in the name
This commit is contained in:
4 files changed
+17
-9
No files matched your search
@@ -750,7 +750,7 @@ def test_snapshots(project):
|
||||
def test_get_snapshot(project):
|
||||
|
||||
os.makedirs(os.path.join(project.path, "snapshots"))
|
||||
open(os.path.join(project.path, "snapshots", "test1.gns3project"), "w+").close()
|
||||
open(os.path.join(project.path, "snapshots", "test1_260716_103713.gns3project"), "w+").close()
|
||||
project.reset()
|
||||
|
||||
snapshot = list(project.snapshots.values())[0]
|
||||
|
||||
@@ -61,15 +61,21 @@ def test_snapshot_filename(project):
|
||||
|
||||
def test_json(project):
|
||||
|
||||
snapshot = Snapshot(project, filename="test1_260716_100439.gns3project")
|
||||
snapshot = Snapshot(project, filename="snapshot_test_260716_100439.gns3project")
|
||||
assert snapshot.__json__() == {
|
||||
"snapshot_id": snapshot._id,
|
||||
"name": "test1",
|
||||
"name": "snapshot_test",
|
||||
"project_id": project.id,
|
||||
"created_at": 1469527479
|
||||
}
|
||||
|
||||
|
||||
def test_invalid_snapshot_filename(project):
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
Snapshot(project, filename="snapshot_test_invalid_file.gns3project")
|
||||
|
||||
|
||||
async def test_restore(project, controller):
|
||||
|
||||
compute = AsyncioMagicMock()
|
||||
|
||||
Reference in new issue
Block a user