func TestList(t *testing.T) {
	th.SetupHTTP()
	defer th.TeardownHTTP()
	HandleListSuccessfully(t)

	count := 0
	err := keypairs.List(client.ServiceClient()).EachPage(func(page pagination.Page) (bool, error) {
		count++
		actual, err := keypairs.ExtractKeyPairs(page)
		th.AssertNoErr(t, err)
		th.CheckDeepEquals(t, ExpectedKeyPairSlice, actual)

		return true, nil
	})
	th.AssertNoErr(t, err)
	th.CheckEquals(t, 1, count)
}
func TestKeypairsList(t *testing.T) {
	client, err := clients.NewComputeV2Client()
	if err != nil {
		t.Fatalf("Unable to create a compute client: %v", err)
	}

	allPages, err := keypairs.List(client).AllPages()
	if err != nil {
		t.Fatalf("Unable to retrieve keypairs: %s", err)
	}

	allKeys, err := keypairs.ExtractKeyPairs(allPages)
	if err != nil {
		t.Fatalf("Unable to extract keypairs results: %s", err)
	}

	for _, keypair := range allKeys {
		PrintKeyPair(t, &keypair)
	}
}