/breezy/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy/unstable

« back to all changes in this revision

Viewing changes to breezy/tests/test_errors.py

Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
202
202
            "smart protocol.",
203
203
            str(error))
204
204
 
205
 
    def test_no_help_topic(self):
206
 
        error = errors.NoHelpTopic("topic")
207
 
        self.assertEqualDiff("No help could be found for 'topic'. "
208
 
            "Please use 'brz help topics' to obtain a list of topics.",
209
 
            str(error))
210
 
 
211
205
    def test_no_such_id(self):
212
206
        error = errors.NoSuchId("atree", "anid")
213
207
        self.assertEqualDiff("The file id \"anid\" is not present in the tree "
413
407
            "location specified in the merge directive is not a branch: "
414
408
            "foo.", str(error))
415
409
 
416
 
    def test_malformed_bug_identifier(self):
417
 
        """Test the formatting of MalformedBugIdentifier."""
418
 
        error = errors.MalformedBugIdentifier('bogus', 'reason for bogosity')
419
 
        self.assertEqual(
420
 
            'Did not understand bug identifier bogus: reason for bogosity. '
421
 
            'See "brz help bugs" for more information on this feature.',
422
 
            str(error))
423
 
 
424
410
    def test_unexpected_smart_server_response(self):
425
411
        e = errors.UnexpectedSmartServerResponse(('not yes',))
426
412
        self.assertEqual(
505
491
 
506
492
    def test_invalid_url_join(self):
507
493
        """Test the formatting of InvalidURLJoin."""
508
 
        e = errors.InvalidURLJoin('Reason', 'base path', ('args',))
 
494
        e = urlutils.InvalidURLJoin('Reason', 'base path', ('args',))
509
495
        self.assertEqual(
510
496
            "Invalid URL join request: Reason: 'base path' + ('args',)",
511
497
            str(e))
512
498
 
513
 
    def test_incorrect_url(self):
514
 
        err = errors.InvalidBugTrackerURL('foo', 'http://bug.com/')
515
 
        self.assertEqual(
516
 
            ("The URL for bug tracker \"foo\" doesn't contain {id}: "
517
 
             "http://bug.com/"),
518
 
            str(err))
519
 
 
520
499
    def test_unable_encode_path(self):
521
500
        err = errors.UnableEncodePath('foo', 'executable')
522
501
        self.assertEqual("Unable to encode executable path 'foo' in "
619
598
        err = errors.NotBranchError('path', controldir=FakeBzrDir())
620
599
        self.assertEqual('Not a branch: "path": NotBranchError.', str(err))
621
600
 
622
 
    def test_invalid_pattern(self):
623
 
        error = errors.InvalidPattern('Bad pattern msg.')
624
 
        self.assertEqualDiff("Invalid pattern(s) found. Bad pattern msg.",
625
 
            str(error))
626
 
 
627
601
    def test_recursive_bind(self):
628
602
        error = errors.RecursiveBind('foo_bar_branch')
629
603
        msg = ('Branch "foo_bar_branch" appears to be bound to itself. '
689
663
            str(e),
690
664
            r'Cannot bind address "example\.com:22":.*Permission denied')
691
665
 
692
 
    def test_file_timestamp_unavailable(self):
693
 
        e = errors.FileTimestampUnavailable("/path/foo")
694
 
        self.assertEqual("The filestamp for /path/foo is not available.",
695
 
                         str(e))
696
 
 
697
666
    def test_transform_rename_failed(self):
698
667
        e = errors.TransformRenameFailed(u"from", u"to", "readonly file", 2)
699
668
        self.assertEqual(
725
694
                             repo.controldir.root_transport.base,
726
695
                             str(error))
727
696
 
728
 
    def test_unknown_bug_tracker_abbreviation(self):
729
 
        """Test the formatting of UnknownBugTrackerAbbreviation."""
730
 
        branch = self.make_branch('some_branch')
731
 
        error = errors.UnknownBugTrackerAbbreviation('xxx', branch)
732
 
        self.assertEqual(
733
 
            "Cannot find registered bug tracker called xxx on %s" % branch,
734
 
            str(error))
735
 
 
736
697
    def test_not_branch_bzrdir_with_repo(self):
737
698
        controldir = self.make_repository('repo').controldir
738
699
        err = errors.NotBranchError('path', controldir=controldir)