isso/specs/test_migration.py

32 lines
626 B
Python
Raw Normal View History

2013-12-18 11:51:14 +00:00
# -*- encoding: utf-8 -*-
import tempfile
from os.path import join, dirname
from isso.core import Config
from isso.db import SQLite3
2013-12-12 11:24:37 +00:00
from wynaut.imprt import Disqus
2013-12-18 11:51:14 +00:00
def test_disqus():
xml = join(dirname(__file__), "disqus.xml")
xxx = tempfile.NamedTemporaryFile()
db = SQLite3(xxx.name, Config.load(None))
2013-12-12 11:24:37 +00:00
dsq = Disqus(xml)
dsq.migrate(db)
2013-12-18 11:51:14 +00:00
assert db.threads["/"]["title"] == "Hello, World!"
assert db.threads["/"]["id"] == 1
a = db.comments.get(1)
assert a["author"] == "peter"
assert a["email"] == "foo@bar.com"
b = db.comments.get(2)
assert b["parent"] == a["id"]