MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / testUnsafePattern

Method testUnsafePattern

src/Test/TestDb.py:124–137  ·  view source on GitHub ↗
(self, db)

Source from the content-addressed store, hash-verified

122 assert db.execute("SELECT COUNT(*) AS num FROM test").fetchone()["num"] == 1
123
124 def testUnsafePattern(self, db):
125 db.schema["maps"] = {"[A-Za-z.]*": db.schema["maps"]["data.json"]} # Only repetition of . supported
126 f = io.StringIO()
127 f.write("""
128 {
129 "test": [
130 {"test_id": 1, "title": "Test 1 title", "extra col": "Ignore it"}
131 ]
132 }
133 """)
134 f.seek(0)
135 assert db.updateJson(db.db_dir + "data.json", f) is False
136 assert db.execute("SELECT COUNT(*) AS num FROM test_importfilter").fetchone()["num"] == 0
137 assert db.execute("SELECT COUNT(*) AS num FROM test").fetchone()["num"] == 0

Callers

nothing calls this directly

Calls 4

updateJsonMethod · 0.80
writeMethod · 0.45
seekMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected