def test___eq__(self): conn, client = self.make_connection_and_client() self.assertThat(client, Equals(client)) client_for_same_connection = common.Client(conn) self.assertThat(client, Equals(client_for_same_connection)) _, client_for_another_connection = self.make_connection_and_client() self.assertThat(client, Not(Equals(client_for_another_connection)))
def test_call_with_keyword_arguments_raises_useful_error(self): conn = DummyConnection() client = common.Client(conn) expected_message = re.escape( "provisioningserver.rpc.common.Client called with 3 positional " "arguments, (1, 2, 3), but positional arguments are not " "supported. Usage: client(command, arg1=value1, ...)") with ExpectedException(TypeError, expected_message): client(sentinel.command, 1, 2, 3)
def test_address_for_IConnection(self): conn = FakeConnection() client = common.Client(conn) with ExpectedException(NotImplementedError, ".* only available in the rack\\b"): client.address
def make_connection_and_client(self): conn = FakeConnectionToRegion() client = common.Client(conn) return conn, client
def test_init(self): conn = DummyConnection() client = common.Client(conn) self.assertThat(client._conn, Is(conn))