def test_remote_host_from_proto_fail(): with pytest.raises(IncorrectTypeError) as err_info: RemoteHost.from_proto('') assert err_info.value.message == ( "RemoteHost's parameter 'host' was" " type 'str' but should be of class 'dlpx.virtualization.api" ".common_pb2.RemoteHost'.")
def remote_host(): return RemoteHost("host", "host-reference", "binary_path", "scratch_path")
def test_remote_host_from_proto_success(): remote_host_proto_buf = common_pb2.RemoteHost() remote_host = RemoteHost.from_proto(remote_host_proto_buf) assert isinstance(remote_host, RemoteHost)
def test_remote_host_to_proto_non_default(): remote_host = RemoteHost('name', 'reference', 'binary_path', 'scratch_path') remote_host_proto = remote_host.to_proto() assert isinstance(remote_host_proto, common_pb2.RemoteHost)
def test_init_remote_host_incorrect_scratch_path(): with pytest.raises(IncorrectTypeError) as err_info: RemoteHost('', '', '', 1) assert err_info.value.message == ( "RemoteHost's parameter 'scratch_path' was" " type 'int' but should be of type 'basestring'.")
def test_init_remote_host_success(): RemoteHost(name='name', reference='reference', binary_path='binary_path', scratch_path='scratch_path')
def host(): return RemoteHost(constants.hostname, constants.HostReference, constants.BINARY_PATH, constants.ScratchPath)