mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-02-23 06:54:21 +01:00
add remote pubkey and alias to channel details
This commit is contained in:
@@ -2,6 +2,7 @@ package de.cotto.lndmanagej.controller;
|
||||
|
||||
import de.cotto.lndmanagej.metrics.Metrics;
|
||||
import de.cotto.lndmanagej.service.ChannelService;
|
||||
import de.cotto.lndmanagej.service.NodeService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
@@ -12,9 +13,12 @@ import java.util.Optional;
|
||||
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
|
||||
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL;
|
||||
import static de.cotto.lndmanagej.model.NodeFixtures.ALIAS_2;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
|
||||
import static org.hamcrest.core.Is.is;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||
|
||||
@WebMvcTest(controllers = ChannelDetailsController.class)
|
||||
@@ -27,6 +31,9 @@ class ChannelDetailsControllerIT {
|
||||
@MockBean
|
||||
private ChannelService channelService;
|
||||
|
||||
@MockBean
|
||||
private NodeService nodeService;
|
||||
|
||||
@MockBean
|
||||
@SuppressWarnings("unused")
|
||||
private Metrics metrics;
|
||||
@@ -38,9 +45,12 @@ class ChannelDetailsControllerIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
void details() throws Exception {
|
||||
void getChannelDetails() throws Exception {
|
||||
when(nodeService.getAlias(PUBKEY_2)).thenReturn(ALIAS_2);
|
||||
when(channelService.getLocalChannel(CHANNEL_ID)).thenReturn(Optional.of(LOCAL_OPEN_CHANNEL));
|
||||
mockMvc.perform(get(CHANNEL_PREFIX + "/details"))
|
||||
.andExpect(content().json("{\"channelId\":\"" + CHANNEL_ID.getShortChannelId() + "\"}"));
|
||||
.andExpect(jsonPath("$.channelId", is(String.valueOf(CHANNEL_ID.getShortChannelId()))))
|
||||
.andExpect(jsonPath("$.remotePubkey", is(PUBKEY_2.toString())))
|
||||
.andExpect(jsonPath("$.remoteAlias", is(ALIAS_2)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user