blob: a50fbaea20ff728fc3ca66cc9ab9e08c44822482 [file] [log] [blame]
Jamie Hannafordf0cd1652014-11-04 10:54:11 +01001package vips
Jamie Hannaford2841a532014-11-04 11:05:42 +01002
3import (
4 "testing"
5
6 "github.com/rackspace/gophercloud/pagination"
7 th "github.com/rackspace/gophercloud/testhelper"
8 "github.com/rackspace/gophercloud/testhelper/client"
9)
10
11const (
12 lbID = 12345
13 vipID = 67890
14)
15
16func TestList(t *testing.T) {
17 th.SetupHTTP()
18 defer th.TeardownHTTP()
19
20 mockListResponse(t, lbID)
21
22 count := 0
23
24 err := List(client.ServiceClient(), lbID).EachPage(func(page pagination.Page) (bool, error) {
25 count++
26 actual, err := ExtractVIPs(page)
27 th.AssertNoErr(t, err)
28
29 expected := []VIP{
30 VIP{ID: 1000, Address: "206.10.10.210", Type: "PUBLIC"},
31 }
32
33 th.CheckDeepEquals(t, expected, actual)
34
35 return true, nil
36 })
37
38 th.AssertNoErr(t, err)
39 th.AssertEquals(t, 1, count)
40}