def test_write_data_to_grpc(): """Convert a WriteData instance to its gRPC equivalent.""" wd = client.WriteData(action='test', raw=[b'test']) rpc = wd.to_grpc() assert isinstance(rpc, synse_api.WriteData) assert rpc.action == 'test' assert rpc.raw == [b'test']
def test_write_data(): """Test initializing WriteData instances.""" wd = client.WriteData() assert wd.action == '' assert wd.raw == [] wd = client.WriteData(action='test') assert wd.action == 'test' assert wd.raw == [] wd = client.WriteData(raw=[b'test']) assert wd.action == '' assert wd.raw == [b'test'] wd = client.WriteData(action='test', raw=[b'test']) assert wd.action == 'test' assert wd.raw == [b'test']
def test_client_write(): """Test writing via the client.""" c = client.PluginUnixClient('foo/bar/test.sock') c.grpc.Write = mock_write resp = c.write('rack-1', 'vec', '12345', [client.WriteData()]) assert isinstance(resp, synse_grpc.api.Transactions)
def test_client_write(): """Test writing via the client.""" c = client.SynseInternalClient('test', 'test.sock', 'unix') c.stub.Write = mock_write resp = c.write('rack-1', 'vec', '12345', [client.WriteData()]) assert isinstance(resp, synse_api.Transactions)
def test_write_data(): """Test initializing WriteData instances.""" wd = client.WriteData() assert wd.action == '' assert wd.data == b'' wd = client.WriteData(action='test') assert wd.action == 'test' assert wd.data == b'' wd = client.WriteData(data=b'test') assert wd.action == '' assert wd.data == b'test' wd = client.WriteData(action='test', data=b'test') assert wd.action == 'test' assert wd.data == b'test'