def test_json(project): snapshot = Snapshot(project, filename="test1_260716_100439.gns3project") assert snapshot.__json__() == { "snapshot_id": snapshot._id, "name": "test1", "project_id": project.id, "created_at": 1469527479 }
def test_snapshot_name(project): """ Test create a snapshot object with a name """ snapshot = Snapshot(project, name="test1") assert snapshot.name == "test1" assert snapshot._created_at > 0 assert snapshot.path.startswith( os.path.join(project.path, "snapshots", "test1_")) assert snapshot.path.endswith(".gns3project") # Check if UTC conversion doesn't corrupt the path snap2 = Snapshot(project, filename=os.path.basename(snapshot.path)) assert snap2.path == snapshot.path
def test_snapshot_filename(project): """ Test create a snapshot object with a filename """ snapshot = Snapshot(project, filename="test1_260716_100439.gns3project") assert snapshot.name == "test1" assert snapshot._created_at == 1469527479.0 assert snapshot.path == os.path.join(project.path, "snapshots", "test1_260716_100439.gns3project")