~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-01-26 10:49:57 UTC
  • mfrom: (4987.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100126104957-dmtqnc0pckuruyla
(vila,
        jam) Implement TestCase.overrideAttr to simplify tests setUp/cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1670
1670
            'password ignored in section \[ssh with password\]')
1671
1671
 
1672
1672
    def test_uses_fallback_stores(self):
1673
 
        self._old_cs_registry = config.credential_store_registry
1674
 
        def restore():
1675
 
            config.credential_store_registry = self._old_cs_registry
1676
 
        self.addCleanup(restore)
1677
 
        config.credential_store_registry = config.CredentialStoreRegistry()
 
1673
        self.overrideAttr(config, 'credential_store_registry',
 
1674
                          config.CredentialStoreRegistry())
1678
1675
        store = StubCredentialStore()
1679
1676
        store.add_credentials("http", "example.com", "joe", "secret")
1680
1677
        config.credential_store_registry.register("stub", store, fallback=True)