@@ -88,3 +88,35 @@ func TestGet(t *testing.T) {
8888 "enable_distributed_routing" : false ,
8989 })
9090}
91+
92+ func TestListDHCPNetworks (t * testing.T ) {
93+ th .SetupHTTP ()
94+ defer th .TeardownHTTP ()
95+
96+ th .Mux .HandleFunc ("/v2.0/agents/43583cf5-472e-4dc8-af5b-6aed4c94ee3a/dhcp-networks" , func (w http.ResponseWriter , r * http.Request ) {
97+ th .TestMethod (t , r , "GET" )
98+ th .TestHeader (t , r , "X-Auth-Token" , fake .TokenID )
99+
100+ w .Header ().Add ("Content-Type" , "application/json" )
101+ w .WriteHeader (http .StatusOK )
102+
103+ fmt .Fprintf (w , AgentDHCPNetworksListResult )
104+ })
105+
106+ s , err := agents .ListDHCPNetworks (fake .ServiceClient (), "43583cf5-472e-4dc8-af5b-6aed4c94ee3a" ).Extract ()
107+ th .AssertNoErr (t , err )
108+
109+ var nilSlice []string
110+ th .AssertEquals (t , len (s ), 1 )
111+ th .AssertEquals (t , s [0 ].ID , "d32019d3-bc6e-4319-9c1d-6722fc136a22" )
112+ th .AssertEquals (t , s [0 ].AdminStateUp , true )
113+ th .AssertEquals (t , s [0 ].ProjectID , "4fd44f30292945e481c7b8a0c8908869" )
114+ th .AssertEquals (t , s [0 ].Shared , false )
115+ th .AssertEquals (t , s [0 ].Name , "net1" )
116+ th .AssertEquals (t , s [0 ].Status , "ACTIVE" )
117+ th .AssertDeepEquals (t , s [0 ].Tags , nilSlice )
118+ th .AssertEquals (t , s [0 ].TenantID , "4fd44f30292945e481c7b8a0c8908869" )
119+ th .AssertDeepEquals (t , s [0 ].AvailabilityZoneHints , []string {})
120+ th .AssertDeepEquals (t , s [0 ].Subnets , []string {"54d6f61d-db07-451c-9ab3-b9609b6b6f0b" })
121+
122+ }
0 commit comments