def _make_one(self, config=None): if config is None: config = self._make_config() from rbit import Client client = Client.from_config(config) self._patch_client_channel(client) return client
def test_connecting_and_disconnecting(self): # This is mostly a smoke test to check for common errors. from rbit import Config config = Config.from_file(TESTING_CONFIG) from rbit import Client client = Client.from_config(config) with client as connected_client: connected_client.act()
def test_no_connection_error(self): # Make sure the NotConnectedError is raised when a connection # hasn't been initialized. from rbit import Config config = Config.from_file(TESTING_CONFIG) from rbit import Client client = Client.from_config(config) from rbit import NotConnectedError with self.assertRaises(NotConnectedError): client.act()
def test_client_init_from_config(self): # Test the client can be initialized from a configuration # object. from rbit import Config config = Config.from_file(TESTING_CONFIG) from rbit import Client client = Client.from_config(config) # We'll assume the setting were set correctly. If they # weren't... well, stuff won't work. # This is more of a check that the class method can create an # Client instance. self.assertTrue(isinstance(client, Client))