diff options
author | W. Trevor King <wking@drexel.edu> | 2008-12-01 14:42:20 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2008-12-01 14:42:20 -0500 |
commit | a98aafc8572bb826a0fda1b6bca0011fc4ef126a (patch) | |
tree | be9f356cf9a737237c360200cdd41fba3ba1ac7b /libbe/bugdir.py | |
parent | 5c3b1999a162d6b1434e9746717f293ea24462aa (diff) | |
download | bugseverywhere-a98aafc8572bb826a0fda1b6bca0011fc4ef126a.tar.gz |
Added decorator-style properties to libbe/comment.py.
Also some typo corrections and some reworking of bug/bugdir to better
support the lazier loading.
Diffstat (limited to 'libbe/bugdir.py')
-rw-r--r-- | libbe/bugdir.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/libbe/bugdir.py b/libbe/bugdir.py index 6bb6a43..1142e3d 100644 --- a/libbe/bugdir.py +++ b/libbe/bugdir.py @@ -409,6 +409,7 @@ only saved if ._save_user_id == True""") def _clear_bugs(self): while len(self) > 0: self.pop() + self._bug_map_gen() def _load_bug(self, uuid): bg = bug.Bug(bugdir=self, uuid=uuid, from_disk=True) @@ -567,6 +568,37 @@ class BugDirTestCase(unittest.TestCase): self.failUnless(bugA == bugAprime, "%s != %s" % (bugA, bugAprime)) self.bugdir.save() self.versionTest() + def testComments(self): + self.bugdir.new_bug(uuid="a", summary="Ant") + bug = self.bugdir.bug_from_uuid("a") + comm = bug.comment_root + rep = comm.new_reply("Ants are small.") + rep.new_reply("And they have six legs.") + self.bugdir.save() + self.bugdir._clear_bugs() + bug = self.bugdir.bug_from_uuid("a") + bug.load_comments() + self.failUnless(len(bug.comment_root)==1, len(bug.comment_root)) + for index,comment in enumerate(bug.comments()): + if index == 0: + repLoaded = comment + self.failUnless(repLoaded.uuid == rep.uuid, repLoaded.uuid) + self.failUnless(comment.sync_with_disk == True, + comment.sync_with_disk) + #load_settings() + self.failUnless(comment.content_type == "text/plain", + comment.content_type) + self.failUnless(repLoaded.settings["Content-type"]=="text/plain", + repLoaded.settings) + self.failUnless(repLoaded.body == "Ants are small.", + repLoaded.body) + elif index == 1: + self.failUnless(comment.in_reply_to == repLoaded.uuid, + repLoaded.uuid) + self.failUnless(comment.body == "And they have six legs.", + comment.body) + else: + self.failIf(True, "Invalid comment: %d\n%s" % (index, comment)) unitsuite = unittest.TestLoader().loadTestsFromTestCase(BugDirTestCase) suite = unittest.TestSuite([unitsuite])#, doctest.DocTestSuite()]) |