def testGetNetworkInfoWithNoIp(self): """Queries network info with no public IP address.""" self.setIsMoblab(True) self.mox.StubOutWithMock(moblab_rpc_interface, '_get_network_info') moblab_rpc_interface._get_network_info().AndReturn((None, False)) self.mox.StubOutWithMock(rpc_utils, 'prepare_for_serialization') rpc_utils.prepare_for_serialization({'is_connected': False}) self.mox.ReplayAll() moblab_rpc_interface.get_network_info() self.mox.VerifyAll()
def testGetNetworkInfoWithNoConnectivity(self): """Queries network info with public IP address but no connectivity.""" self.setIsMoblab(True) self.mox.StubOutWithMock(moblab_rpc_interface, '_get_network_info') moblab_rpc_interface._get_network_info().AndReturn(('10.0.0.1', False)) self.mox.StubOutWithMock(rpc_utils, 'prepare_for_serialization') rpc_utils.prepare_for_serialization( {'is_connected': False, 'server_ips': ['10.0.0.1']}) self.mox.ReplayAll() moblab_rpc_interface.get_network_info() self.mox.VerifyAll()
def testGetNetworkInfo(self): """Ensure the network info is properly converted to a dict.""" self.setIsMoblab(True) self.mox.StubOutWithMock(moblab_rpc_interface, '_get_network_info') moblab_rpc_interface._get_network_info().AndReturn(('10.0.0.1', True)) self.mox.StubOutWithMock(rpc_utils, 'prepare_for_serialization') rpc_utils.prepare_for_serialization( {'is_connected': True, 'server_ips': ['10.0.0.1']}) self.mox.ReplayAll() moblab_rpc_interface.get_network_info() self.mox.VerifyAll()