Rev 448: Fix the existing annotate-file test. (bug #686324) in http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

John Arbash Meinel john at arbash-meinel.com
Mon Feb 7 21:40:26 UTC 2011


At http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

------------------------------------------------------------
revno: 448 [merge]
revision-id: john at arbash-meinel.com-20110207213943-fte8v350059lyz4h
parent: john at arbash-meinel.com-20110127233202-hcft5x00k2gbjc9e
parent: john at arbash-meinel.com-20110131212706-8ol6flm3yvibi9fb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk-rich
timestamp: Mon 2011-02-07 15:39:43 -0600
message:
  Fix the existing annotate-file test. (bug #686324)
modified:
  loggerhead/tests/test_controllers.py test_controllers.py-20090210051739-5d14nlvjvn2ep4x5-1
-------------- next part --------------
=== modified file 'loggerhead/tests/test_controllers.py'
--- a/loggerhead/tests/test_controllers.py	2010-05-14 09:10:06 +0000
+++ b/loggerhead/tests/test_controllers.py	2011-01-31 21:27:06 +0000
@@ -61,20 +61,25 @@
 
     def make_annotate_ui_for_file_history(self, file_id, rev_ids_texts):
         tree = self.make_branch_and_tree('.')
-        open('filename', 'w').write('')
+        self.build_tree_contents([('filename', '')])
         tree.add(['filename'], [file_id])
         for rev_id, text in rev_ids_texts:
-            open('filename', 'w').write(text)
+            self.build_tree_contents([('filename', text)])
             tree.commit(rev_id=rev_id, message='.')
         tree.branch.lock_read()
         self.addCleanup(tree.branch.unlock)
-        branch_app = BranchWSGIApp(tree.branch)
+        branch_app = BranchWSGIApp(tree.branch, friendly_name='test_name')
         return AnnotateUI(branch_app, branch_app.get_history)
 
     def test_annotate_file(self):
         history = [('rev1', 'old\nold\n'), ('rev2', 'new\nold\n')]
         ann_ui = self.make_annotate_ui_for_file_history('file_id', history)
-        annotated = list(ann_ui.annotate_file('file_id', 'rev2'))
+        # A lot of this state is set up by __call__, but we'll do it directly
+        # here.
+        ann_ui.args = ['rev2']
+        annotate_info = ann_ui.get_values('filename',
+            kwargs={'file_id': 'file_id'}, headers={})
+        annotated = list(annotate_info['annotated'])
         self.assertEqual(2, len(annotated))
         self.assertEqual('2', annotated[0].change.revno)
         self.assertEqual('1', annotated[1].change.revno)



More information about the bazaar-commits mailing list