~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Aaron Bentley
  • Date: 2008-04-04 17:11:06 UTC
  • mto: (3242.2.7 repository-policy)
  • mto: This revision was merged to the branch mainline in revision 3354.
  • Revision ID: aaron@aaronbentley.com-20080404171106-7qsjphtlecdq8drb
Turn BzrDirConfig into TransportConfig, reduce code duplication

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    urlutils,
34
34
    tests,
35
35
    trace,
 
36
    transport,
36
37
    )
37
38
from bzrlib.util.configobj import configobj
38
39
 
160
161
    def __init__(self, user_id=None):
161
162
        self.email = user_id
162
163
        self.files = {}
 
164
        self._transport = self
163
165
 
164
166
    def get_utf8(self, filename):
165
167
        if filename != 'email':
177
179
    def put(self, filename, fileobj):
178
180
        self.files[filename] = fileobj.read()
179
181
 
 
182
    def put_file(self, filename, fileobj):
 
183
        return self.put(filename, fileobj)
 
184
 
180
185
 
181
186
class InstrumentedConfig(config.Config):
182
187
    """An instrumented config that supplies stubs for template methods."""
1136
1141
        self.assertEqual(value, 'value3-section')
1137
1142
 
1138
1143
 
1139
 
class TestBzrDirConfig(tests.TestCaseWithTransport):
 
1144
class TestTransportConfig(tests.TestCaseWithTransport):
1140
1145
 
1141
1146
    def test_get_value(self):
1142
1147
        """Test that retreiving a value from a section is possible"""
1143
 
        my_dir = self.make_bzrdir('.')
1144
 
        bzrdir_config = config.BzrDirConfig(my_dir.transport)
 
1148
        bzrdir_config = config.TransportConfig(transport.get_transport('.'),
 
1149
                                               'control.conf')
1145
1150
        bzrdir_config.set_option('value', 'key', 'SECTION')
1146
1151
        bzrdir_config.set_option('value2', 'key2')
1147
1152
        bzrdir_config.set_option('value3-top', 'key3')