Update the CVS unit tests to use build_client().
This updates the CVS unit tests to build a `CVSClient` in each test
where it's needed, rather than in `setUp()`. This is in prepration for
new tests that will need to handle client construction differently.
Testing Done:
CVS unit tests pass.
Reviewed at
@@ -12,17 +12,16 @@ from rbtools.clients.tests import SCMClientTestCase
class CVSClientTests(kgb.SpyAgency, SCMClientTestCase):
"""Unit tests for CVSClient."""
- def setUp(self):
- super(CVSClientTests, self).setUp()
-
- self.client = CVSClient(options=self.options)
+ scmclient_cls = CVSClient
def test_get_repository_info_with_found(self):
"""Testing CVSClient.get_repository_info with repository found"""
- self.spy_on(CVSClient.get_local_path,
+ client = self.build_client()
+
+ self.spy_on(client.get_local_path,
op=kgb.SpyOpReturn('/path/to/cvsdir'))
- repository_info = self.client.get_repository_info()
+ repository_info = client.get_repository_info()
self.assertIsInstance(repository_info, RepositoryInfo)
self.assertIsNone(repository_info.base_path)
@@ -31,9 +30,11 @@ class CVSClientTests(kgb.SpyAgency, SCMClientTestCase):
def test_get_repository_info_with_not_found(self):
"""Testing CVSClient.get_repository_info with repository not found"""
- self.spy_on(CVSClient.get_local_path,
+ client = self.build_client()
+
+ self.spy_on(client.get_local_path,
op=kgb.SpyOpReturn(None))
- repository_info = self.client.get_repository_info()
+ repository_info = client.get_repository_info()
self.assertIsNone(repository_info)
