~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_branch/test_branch.py

  • Committer: Aaron Bentley
  • Date: 2012-07-12 19:11:54 UTC
  • mto: This revision was merged to the branch mainline in revision 6540.
  • Revision ID: aaron@aaronbentley.com-20120712191154-3fniuw24jlnat2nw
Migrate tests to per_branch, support RemoteBranch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
"""Tests for branch implementations - tests a branch format."""
18
18
 
 
19
from cStringIO import StringIO
 
20
 
19
21
from bzrlib import (
20
22
    branch as _mod_branch,
21
23
    controldir,
1057
1059
        # above the control dir but we might need to relax that?
1058
1060
        self.assertEqual(br.control_url.find(br.user_url), 0)
1059
1061
        self.assertEqual(br.control_url, br.control_transport.base)
 
1062
 
 
1063
 
 
1064
class TestUncommittedChanges(per_branch.TestCaseWithBranch):
 
1065
 
 
1066
    def test_get_put_uncommitted(self):
 
1067
        branch = self.make_branch('branch')
 
1068
        self.assertIs(None, branch._get_uncommitted())
 
1069
        branch._put_uncommitted(StringIO('Hello'))
 
1070
        self.assertEqual('Hello', branch._get_uncommitted().read())
 
1071
 
 
1072
    def test_uncommitted_none(self):
 
1073
        branch = self.make_branch('branch')
 
1074
        branch._put_uncommitted(StringIO('Hello'))
 
1075
        branch._put_uncommitted(None)
 
1076
        self.assertIs(None, branch._get_uncommitted())
 
1077
        # Setting uncommitted to None when it is already None is not an error.
 
1078
        branch._put_uncommitted(None)