*/
@Test(groups = "unit", testName = "KeyPairApiMockTest")
public class KeyPairApiMockTest extends BaseDigitalOceanMockTest {
public void testListKeys() throws Exception {
MockWebServer server = mockWebServer();
server.enqueue(new MockResponse().setBody(payloadFromResource("/keys.json")));
DigitalOceanApi api = api(server.getUrl("/"));
KeyPairApi keyPairApi = api.getKeyPairApi();
try {
List<SshKey> keys = keyPairApi.list();
assertRequestHasCommonFields(server.takeRequest(), "/ssh_keys");
assertEquals(keys.size(), 1);
} finally {
api.close();
server.shutdown();
}
}