def setUp(self): """Set up communicator tests.""" super(ClientCommsTest, self).setUp() # These tests change the config so we preserve state. self.config_stubber = test_lib.PreserveConfig() self.config_stubber.Start() self.client_private_key = config_lib.CONFIG["Client.private_key"] self.server_serial_number = 0 self.server_certificate = config_lib.CONFIG["Frontend.certificate"] self.server_private_key = config_lib.CONFIG["PrivateKeys.server_key"] self.client_communicator = comms.ClientCommunicator( private_key=self.client_private_key) self.client_communicator.LoadServerCertificate( server_certificate=self.server_certificate, ca_certificate=config_lib.CONFIG["CA.certificate"]) self.server_communicator = front_end.ServerCommunicator( certificate=self.server_certificate, private_key=self.server_private_key, token=self.token) self.last_urlmock_error = None
def CreateNewServerCommunicator(self): self.server_communicator = front_end.ServerCommunicator( certificate=self.server_certificate, private_key=self.server_private_key, token=self.token) self.server_communicator.client_cache.Put(self.client_cn, self.client)