"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/dulcinea/lib/test/utest_comment.py $
$Id: utest_comment.py 31124 2008-09-16 17:35:28Z dbinger $
"""
from dulcinea.comment import Comment
from dulcinea.common import CommonTest
from dulcinea.user import DulcineaUser
from qp.pub.common import site_now

class CommentTest (CommonTest):

    def check_comment (self):
        user = DulcineaUser("jblow")
        t1 = site_now()
        c = Comment("Hello", user)
        assert c.get_text() == "Hello"
        assert c.get_user() == user
        t2 = site_now()
        assert c.text == "Hello"
        assert c.user == user
        assert t1 <= c.get_timestamp() <= t2
        assert str(c) == "%s at %s" % (user, c.get_timestamp())
        d = Comment("H", user)
        assert d != c

if __name__ == "__main__":
    CommentTest()
