/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/tests/test_osutils.py

  • Committer: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-06-01 21:57:00 UTC
  • mfrom: (7490.39.3 move-launchpad)
  • Revision ID: breezy.the.bot@gmail.com-20200601215700-joxuzo6w172gq74v
Move launchpad hoster support to the launchpad plugin.

Merged from https://code.launchpad.net/~jelmer/brz/move-launchpad/+merge/384931

Show diffs side-by-side

added added

removed removed

Lines of Context:
818
818
                          osutils.safe_utf8, b'\xbb\xbb')
819
819
 
820
820
 
 
821
class TestSafeRevisionId(tests.TestCase):
 
822
 
 
823
    def test_from_ascii_string(self):
 
824
        # this shouldn't give a warning because it's getting an ascii string
 
825
        self.assertEqual(b'foobar', osutils.safe_revision_id(b'foobar'))
 
826
 
 
827
    def test_from_unicode_string_ascii_contents(self):
 
828
        self.assertRaises(TypeError,
 
829
                          osutils.safe_revision_id, u'bargam')
 
830
 
 
831
    def test_from_unicode_string_unicode_contents(self):
 
832
        self.assertRaises(TypeError,
 
833
                          osutils.safe_revision_id, u'bargam\xae')
 
834
 
 
835
    def test_from_utf8_string(self):
 
836
        self.assertEqual(b'foo\xc2\xae',
 
837
                         osutils.safe_revision_id(b'foo\xc2\xae'))
 
838
 
 
839
    def test_none(self):
 
840
        """Currently, None is a valid revision_id"""
 
841
        self.assertEqual(None, osutils.safe_revision_id(None))
 
842
 
 
843
 
 
844
class TestSafeFileId(tests.TestCase):
 
845
 
 
846
    def test_from_ascii_string(self):
 
847
        self.assertEqual(b'foobar', osutils.safe_file_id(b'foobar'))
 
848
 
 
849
    def test_from_unicode_string_ascii_contents(self):
 
850
        self.assertRaises(TypeError, osutils.safe_file_id, u'bargam')
 
851
 
 
852
    def test_from_unicode_string_unicode_contents(self):
 
853
        self.assertRaises(TypeError,
 
854
                          osutils.safe_file_id, u'bargam\xae')
 
855
 
 
856
    def test_from_utf8_string(self):
 
857
        self.assertEqual(b'foo\xc2\xae',
 
858
                         osutils.safe_file_id(b'foo\xc2\xae'))
 
859
 
 
860
    def test_none(self):
 
861
        """Currently, None is a valid revision_id"""
 
862
        self.assertEqual(None, osutils.safe_file_id(None))
 
863
 
 
864
 
821
865
class TestSendAll(tests.TestCase):
822
866
 
823
867
    def test_send_with_disconnected_socket(self):