replace assert with assertEqual

This commit is contained in:
Martin Zimmermann 2014-04-30 15:24:16 +02:00
parent 910da2a6c0
commit 0154113c80

View File

@ -1,5 +1,10 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
try:
import unittest2 as unittest
except ImportError:
import unittest
import tempfile import tempfile
from os.path import join, dirname from os.path import join, dirname
@ -9,7 +14,9 @@ from isso.db import SQLite3
from isso.migrate import Disqus from isso.migrate import Disqus
def test_disqus(): class TestMigration(unittest.TestCase):
def test_disqus(self):
xml = join(dirname(__file__), "disqus.xml") xml = join(dirname(__file__), "disqus.xml")
xxx = tempfile.NamedTemporaryFile() xxx = tempfile.NamedTemporaryFile()
@ -17,8 +24,16 @@ def test_disqus():
db = SQLite3(xxx.name, Config.load(None)) db = SQLite3(xxx.name, Config.load(None))
Disqus(db, xml).migrate() Disqus(db, xml).migrate()
assert db.threads["/"]["title"] == "Hello, World!" self.assertEqual(db.threads["/"]["title"], "Hello, World!")
assert db.threads["/"]["id"] == 1 self.assertEqual(db.threads["/"]["id"], 1)
a = db.comments.get(1)
self.assertEqual(a["author"], "peter")
self.assertEqual(a["email"], "foo@bar.com")
b = db.comments.get(2)
self.assertEqual(b["parent"] ,a["id"])
a = db.comments.get(1) a = db.comments.get(1)