1120
1122
class TestControlComponent(TestCaseWithWorkingTree):
1121
1123
"""WorkingTree implementations adequately implement ControlComponent."""
1123
1125
def test_urls(self):
1124
1126
wt = self.make_branch_and_tree('wt')
1125
1127
self.assertIsInstance(wt.user_url, str)
1151
1153
def test_set_in_branch(self):
1152
1154
wt = self.make_wt_with_worth_saving_limit()
1153
config = wt.branch.get_config()
1154
config.set_user_option('bzr.workingtree.worth_saving_limit', '20')
1155
conf = config.BranchStack(wt.branch)
1156
conf.set('bzr.workingtree.worth_saving_limit', '20')
1155
1157
self.assertEqual(20, wt._worth_saving_limit())
1156
1158
ds = wt.current_dirstate()
1157
1159
self.assertEqual(10, ds._worth_saving_limit)
1159
1161
def test_invalid(self):
1160
1162
wt = self.make_wt_with_worth_saving_limit()
1161
config = wt.branch.get_config()
1162
config.set_user_option('bzr.workingtree.worth_saving_limit', 'a')
1163
conf = config.BranchStack(wt.branch)
1164
conf.set('bzr.workingtree.worth_saving_limit', 'a')
1163
1165
# If the config entry is invalid, default to 10
1164
# TODO: This writes a warning to the user, trap it somehow
1168
warnings.append(args[0] % args[1:])
1169
self.overrideAttr(trace, 'warning', warning)
1165
1170
self.assertEqual(10, wt._worth_saving_limit())
1171
self.assertLength(1, warnings)
1172
self.assertEquals('Value "a" is not valid for'
1173
' "bzr.workingtree.worth_saving_limit"',
1168
1177
class TestFormatAttributes(TestCaseWithWorkingTree):