class TestHistory(object): """ Class for testing Gears methods """ def setup(self): print "setup" self.hist = History('tem.p', logger=logging.getLogger('temp.log')) self.hist.store(r'http://www.facebook.com') def teardown(self): print "teardown" os.remove('tem.p') if os.path.exists('temp.log'): os.remove('temp.log') def test_file_create(self): assert os.path.exists('tem.p') def test_file_already_created(self): hist = History('tem.p') ok_(hist) def test_history(self): link = r'http://www.google.com' assert not self.hist.check(link) self.hist.store(link) assert self.hist.check(link) def test_check_recent(self): assert self.hist.check_recent(r'http://www.facebook.com') def test_check_recent_neg(self): assert not self.hist.check_recent(r'http://www.myspace.com') def test_check_recent_shallow(self): assert not self.hist.check_recent(r'http://www.facebook.com', days=0)
def setup(self): print "setup" self.hist = History('tem.p', logger=logging.getLogger('temp.log')) self.hist.store(r'http://www.facebook.com')