#!/www/python/bin/python
"""
$URL$
$Id$
"""

from sancho.unittest import TestScenario, parse_args, run_scenarios
from dulcinea.links import LinkItem, LinkFolder, sort_reverse_by_date

tested_modules = ["dulcinea.links"]


class LinksTest (TestScenario):


    def check_link(self):
        self.test_stmt("self.link = LinkItem()")
        self.test_exc("self.link.set_url('bad url')", AssertionError)
        self.test_stmt("self.link.set_url('http://www.mems-exchange.org')")
        self.test_val("self.link.get_url()", 'http://www.mems-exchange.org')
        self.test_stmt("self.link2 = LinkItem()")
        self.test_stmt("[self.link, self.link2].sort(sort_reverse_by_date)")

    def check_link_folder(self):
        self.test_stmt("link_db = LinkFolder()")


if __name__ == "__main__":
    (scenarios, options) = parse_args()
    options.show_coverage = 1
    #options.show_coverage_lines = 1
    run_scenarios(scenarios, options)
