Ejemplo n.º 1
0
 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)))
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def test_address_for_IConnection(self):
     conn = FakeConnection()
     client = common.Client(conn)
     with ExpectedException(NotImplementedError,
                            ".* only available in the rack\\b"):
         client.address
Ejemplo n.º 4
0
 def make_connection_and_client(self):
     conn = FakeConnectionToRegion()
     client = common.Client(conn)
     return conn, client
Ejemplo n.º 5
0
 def test_init(self):
     conn = DummyConnection()
     client = common.Client(conn)
     self.assertThat(client._conn, Is(conn))