Rev 448: Fix a failing test in the annotate code. (bug #686324) in http://bzr.arbash-meinel.com/plugins/loggerhead/annotate_test_fix-686324

John Arbash Meinel john at arbash-meinel.com
Mon Jan 31 21:27:14 UTC 2011


At http://bzr.arbash-meinel.com/plugins/loggerhead/annotate_test_fix-686324

------------------------------------------------------------
revno: 448
revision-id: john at arbash-meinel.com-20110131212706-8ol6flm3yvibi9fb
parent: john at arbash-meinel.com-20110127233202-hcft5x00k2gbjc9e
fixes bug(s): https://launchpad.net/bugs/686324
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: annotate_test_fix-686324
timestamp: Mon 2011-01-31 15:27:06 -0600
message:
  Fix a failing test in the annotate code. (bug #686324)
-------------- 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