~abentley/bzrtools/bzrtools.dev

515 by Aaron Bentley
turn is_clean doctests into unittest, to avoid creating .bazaar directories
1
import os.path
2
552 by Aaron Bentley
Fix deprecation warnings
3
from bzrlib import tests
515 by Aaron Bentley
turn is_clean doctests into unittest, to avoid creating .bazaar directories
4
from bzrlib.plugins.bzrtools.bzrtools import is_clean
5
6
class TestIsClean(tests.TestCaseWithTransport):
531.2.2 by Charlie Shepherd
Remove all trailing whitespace
7
515 by Aaron Bentley
turn is_clean doctests into unittest, to avoid creating .bazaar directories
8
    def test_is_clean(self):
9
        tree = self.make_branch_and_tree('.')
10
        self.assertEqual((True, []), is_clean(tree))
11
        fooname = os.path.join(tree.basedir, "foo")
12
        file(fooname, "wb").write("bar")
13
        self.assertEqual((True, [u'foo']), is_clean(tree))
552 by Aaron Bentley
Fix deprecation warnings
14
        tree.smart_add([tree.basedir])
515 by Aaron Bentley
turn is_clean doctests into unittest, to avoid creating .bazaar directories
15
        self.assertEqual((False, []), is_clean(tree))
16
        tree.commit("added file", rev_id='commit-id')
17
        self.assertEqual((True, []), is_clean(tree))