MCPcopy
hub / github.com/isso-comments/isso / test_generic

Method test_generic

isso/tests/test_migration.py:104–132  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

102 self.assertEqual(last["parent"], None)
103
104 def test_generic(self):
105 filepath = join(dirname(__file__), "generic.json")
106 tempf = tempfile.NamedTemporaryFile()
107
108 db = SQLite3(tempf.name, conf)
109 Generic(db, filepath).migrate()
110
111 self.assertEqual(db.threads["/posts/0001/"]["title"], "Test+post")
112 self.assertEqual(db.threads["/posts/0001/"]["id"], 1)
113
114 self.assertEqual(db.threads["/posts/0007/"]["title"], "Nat+%26+Miguel")
115 self.assertEqual(db.threads["/posts/0007/"]["id"], 2)
116
117 self.assertEqual(len(db.execute("SELECT id FROM threads").fetchall()), 2)
118 self.assertEqual(len(db.execute("SELECT id FROM comments").fetchall()), 2)
119
120 comment = db.comments.get(1)
121 self.assertEqual(comment["author"], "texas holdem")
122 self.assertEqual(comment["text"], "Great men can't be ruled. by free online poker")
123 self.assertEqual(comment["email"], "")
124 self.assertEqual(comment["website"], "http://www.tigerspice.com")
125 self.assertEqual(comment["remote_addr"], "0.0.0.0")
126
127 comment = db.comments.get(2)
128 self.assertEqual(comment["author"], "Richard Crinshaw")
129 self.assertEqual(comment["text"], "Ja-make-a me crazzy mon :)\n")
130 self.assertEqual(comment["email"], "105421439@87750645.com")
131 self.assertEqual(comment["website"], "")
132 self.assertEqual(comment["remote_addr"], "0.0.0.0")
133
134 def test_detection(self):
135 wp = """\

Callers

nothing calls this directly

Calls 6

executeMethod · 0.95
SQLite3Class · 0.90
GenericClass · 0.90
fetchallMethod · 0.80
migrateMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected