#!/www/python/bin/python
"""
$URL: svn+ssh://svn.mems-exchange.org/repos/trunk/mems/lib/lib/test/test_comment.py $
$Id: test_comment.py 23256 2003-12-02 18:38:47Z dbinger $
"""

from mx import DateTime
from sancho.unittest import TestScenario, parse_args, run_scenarios
from dulcinea.comment import Comment
from dulcinea.user import DulcineaUser

tested_modules = [ "dulcinea.comment" ]

class CommentTest (TestScenario):

    def check_comment (self):
        user = DulcineaUser("jblow")
        t1 = DateTime.now()
        c = Comment("Hello", user)
        self.test_val("c.get_text()", "Hello")
        self.test_val("c.get_user()", user)
        t2 = DateTime.now()
        self.test_val("c.text", "Hello")
        self.test_val("c.user", user)
        self.test_true("t1 <= c.get_timestamp() <= t2")
        self.test_val("str(c)", "%s at %s" % (user, c.timestamp))
        d = Comment("H", user)
        self.test_true("d <= c")

if __name__ == "__main__":
    (scenarios, options) = parse_args()
    run_scenarios (scenarios, options)
