/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to tests/test_commit.py

  • Committer: John Arbash Meinel
  • Date: 2007-10-02 23:08:12 UTC
  • mto: (322.1.1 trunk) (330.3.3 trunk)
  • mto: This revision was merged to the branch mainline in revision 368.
  • Revision ID: john@arbash-meinel.com-20071002230812-h8i6pq8fwvodute4
Start testing with Unicode data.
It seems there is some brokenness with serializing Unicode messages.
But otherwise everything seems to be working.

Show diffs side-by-side

added added

removed removed

Lines of Context:
871
871
        self.assertEqual([{'path':'a', 'file_id':'a-id',
872
872
                           'message':'Message for A\n'},
873
873
                         ], bencode.bdecode(file_info))
 
874
 
 
875
    def test_commit_unicode_messages(self):
 
876
        from bzrlib.tests.test_diff import UnicodeFilename
 
877
        self.requireFeature(UnicodeFilename)
 
878
 
 
879
        tree = self.make_branch_and_tree('tree')
 
880
        self.build_tree(['tree/a', u'tree/\u03a9'])
 
881
        tree.add(['a', u'\u03a9'], ['a-id', 'omega-id'])
 
882
 
 
883
        dlg = commit.CommitDialog(tree)
 
884
        dlg._treeview_files.set_cursor((1,)) # 'a'
 
885
        dlg._set_file_commit_message(u'Test \xfan\xecc\xf6de\n')
 
886
        dlg._treeview_files.set_cursor((2,)) # omega
 
887
        dlg._set_file_commit_message(u'\u03a9 is the end of all things.\n')
 
888
        dlg._set_global_commit_message(u'\u03a9 and \xfan\xecc\xf6de\n')
 
889
 
 
890
        self.assertEqual(([u'a', u'\u03a9'],
 
891
                          [{'path':'a', 'file_id':'a-id',
 
892
                            'message':'Test \xc3\xban\xc3\xacc\xc3\xb6de\n'},
 
893
                           {'path':'\xce\xa9', 'file_id':'omega-id',
 
894
                            'message':'\xce\xa9 is the end of all things.\n'},
 
895
                          ]), dlg._get_specific_files())
 
896
 
 
897
        dlg._do_commit()
 
898
 
 
899
        rev = tree.branch.repository.get_revision(dlg.committed_revision_id)
 
900
        file_info = rev.properties['file-info']
 
901
        value = ('ld7:file_id4:a-id'
 
902
                   '7:message16:Test \xc3\xban\xc3\xacc\xc3\xb6de\n'
 
903
                   '4:path1:a'
 
904
                  'e'
 
905
                  'd7:file_id8:omega-id'
 
906
                   '7:message29:\xce\xa9 is the end of all things.\n'
 
907
                   '4:path2:\xce\xa9'
 
908
                  'e'
 
909
                 'e')
 
910
        self.expectFailure('bencode and unicode does not mix properly with'
 
911
                           ' Revision XML serialization.',
 
912
                           self.assertEqual, value, file_info)
 
913
        self.assertEqual(value, file_info)
 
914
        file_info_decoded = bencode.bdecode(file_info)
 
915
        for d in file_info_decoded:
 
916
            d['path'] = d['path'].decode('utf8')
 
917
            d['message'] = d['message'].decode('utf8')
 
918
 
 
919
        self.assertEqual([{'path':u'a', 'file_id':'a-id',
 
920
                           'message':u'Test \xfan\xecc\xf6de\n'},
 
921
                          {'path':u'\u03a9', 'file_id':'omega-id',
 
922
                           'message':u'\u03a9 is the end of all things.\n'},
 
923
                         ], file_info_decoded)